I have a static UITableView, content of each cell I've made in storyboard, but I need to change texLabels of some cells programmatically while runtime. How can I do it?
Create a property for each cell you want to change in your table view controller, like so:
@property (weak) IBOutlet UITableViewCell *cell1;
@property (weak) IBOutlet UITableViewCell *cell2;
Connect each one to a cell in Interface Builder.
When you only need to change the label's text, you can use
self.cell1.textLabel.text = @"New Text";
If you need to replace the whole label, use
UILabel *newLabel = [[UILabel alloc] init];
self.cell2.textLabel = newLabel;
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With