Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit bfa9dd9

Browse files
committedFeb 3, 2024
Activity Indicator Demo: Update start/stop activity button title based on state
1 parent 839b046 commit bfa9dd9

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed
 

‎ios/FluentUI.Demo/FluentUI.Demo/Demos/ActivityIndicatorDemoController.swift

+9-2
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ class ActivityIndicatorDemoController: DemoTableViewController {
5252
return UITableViewCell()
5353
}
5454

55-
cell.setup(action1Title: row.title)
55+
cell.setup(action1Title: isAnimating ? "Stop Activity" : "Start Activity")
5656
cell.action1Button.addTarget(self,
5757
action: #selector(startStopActivity),
5858
for: .touchUpInside)
@@ -191,7 +191,7 @@ class ActivityIndicatorDemoController: DemoTableViewController {
191191
case .hidesWhenStopped:
192192
return "Hides when stopped"
193193
case .startStopActivity:
194-
return "Start / Stop activity"
194+
return ""
195195
case .demoOfSize:
196196
return ""
197197
}
@@ -235,6 +235,13 @@ class ActivityIndicatorDemoController: DemoTableViewController {
235235

236236
@objc private func startStopActivity() {
237237
isAnimating.toggle()
238+
239+
guard let section: Int = ActivityIndicatorDemoSection.allCases.firstIndex(of: .settings),
240+
let row: Int = ActivityIndicatorDemoSection.settings.rows.firstIndex(of: .startStopActivity) else {
241+
return
242+
}
243+
// Reloading row to update the button title
244+
tableView.reloadRows(at: [.init(row: row, section: section)], with: .automatic)
238245
}
239246
}
240247

0 commit comments

Comments
 (0)
Please sign in to comment.