Is there a way to get or set the textLabel of a standard UITableViewCell inside a custom method? For instance of a pseudo code,
-(void)getTextLabelOfUITableViewCell
{
UILabel *tempLabel = [[UITableViewCell section:0 row:1] textLabel];
}
-(void)setTextLabelOfUITableViewCell:(UILabel *)data
{
[[UITableViewCell section:0 row:1] textLabel] = data;
}
I’m trying to bind this with the PickerView delegate methods so whenever I change values in the datepicker or picker, the selected UITableViewCell will reflect the changes.
Otherwise I’d have to create a custom UITableViewCell. It’d be nice to be able to programmatically use the standard UITableViewCell Styles.
Thanks in advance!
You should keep (or pass) a reference to the “currently selected cell”. Then you can easily access its text label by simply writing:
In case you’re wondering how to keep such a reference, you should implement the
method, and in it, simply state:
This way, when the user taps the cell, it will be set as the “selected cell”.
Another way to fly would be by adding the reference to the cell you want to edit the text from in the
IBActionas a parameter, like this:And then you could write something like:
You pretty much can do whatever you want with the label from there on.
Hope this helps!