Reputation: 3465
I have a static settings view, for which i wanted to update the values on view load. values are loaded from persistent storage.
How do i update the cell values here?
Note: I can opt do this completely dynamic but i have avoided because we may have many UIControls added later and have design layout concerns
Upvotes: 0
Views: 38
Reputation: 1544
If you are using static cells then you will need to create @IBOutlet references to that specific cell you want to update.
Then you can do like that :
var indexPath: NSIndexPath = NSIndexPath.indexPathForItem(@indexPath, inSection: 0)
tblStaticCell.beginUpdates()
tblStaticCell.reloadRowsAtIndexPaths([indexPath], withRowAnimation: UITableViewRowAnimationNone)
tblStaticCell.endUpdates()
Upvotes: 0
Reputation: 4583
If you are using static cells then you will need to create @IBOutlet references to everything that you want to update.
@IBOutlet weak var criticalSwitch
You can then update them in viewDidLoad or ViewDidAppear
This way works when there is a small amount is UI on screen that you need to update, but tends to become difficult to manage when you have a lot.
Upvotes: 1