From bfa9dd9efd20186989519cc5fc3740a63e2bce8c Mon Sep 17 00:00:00 2001 From: Mohammed Imthathullah Date: Fri, 26 Jan 2024 10:54:28 +0530 Subject: [PATCH] Activity Indicator Demo: Update start/stop activity button title based on state --- .../Demos/ActivityIndicatorDemoController.swift | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/ios/FluentUI.Demo/FluentUI.Demo/Demos/ActivityIndicatorDemoController.swift b/ios/FluentUI.Demo/FluentUI.Demo/Demos/ActivityIndicatorDemoController.swift index d7e625c36..bd3cd7393 100644 --- a/ios/FluentUI.Demo/FluentUI.Demo/Demos/ActivityIndicatorDemoController.swift +++ b/ios/FluentUI.Demo/FluentUI.Demo/Demos/ActivityIndicatorDemoController.swift @@ -52,7 +52,7 @@ class ActivityIndicatorDemoController: DemoTableViewController { return UITableViewCell() } - cell.setup(action1Title: row.title) + cell.setup(action1Title: isAnimating ? "Stop Activity" : "Start Activity") cell.action1Button.addTarget(self, action: #selector(startStopActivity), for: .touchUpInside) @@ -191,7 +191,7 @@ class ActivityIndicatorDemoController: DemoTableViewController { case .hidesWhenStopped: return "Hides when stopped" case .startStopActivity: - return "Start / Stop activity" + return "" case .demoOfSize: return "" } @@ -235,6 +235,13 @@ class ActivityIndicatorDemoController: DemoTableViewController { @objc private func startStopActivity() { isAnimating.toggle() + + guard let section: Int = ActivityIndicatorDemoSection.allCases.firstIndex(of: .settings), + let row: Int = ActivityIndicatorDemoSection.settings.rows.firstIndex(of: .startStopActivity) else { + return + } + // Reloading row to update the button title + tableView.reloadRows(at: [.init(row: row, section: section)], with: .automatic) } }