Today I started to get my apps ready for iOS8. I discovered that the subtitles of my UITableCells won't update within viewWillAppear
. I brought that down to a minimal example:
I've got a static cell TableViewController with 2 cells (style = subtitle) One subtitle is empty the other one is set.
I update the subtitles like this:
- (void) viewWillAppear:(BOOL)animated { [super viewWillAppear:animated]; [[self.without detailTextLabel] setText:@"foobar"]; [[self.with detailTextLabel] setText:@"barfoo"]; }
While everythin works under iOS7 (and 6 and 5), iOS8 won't update the title of the first cell.
However, when I touch the cell it will update and show the text.
Is this a simulator issue? A bug? Am I doing something wrong?
As a temporary work around I simple introduced a blank space in the text label and programmatically where I set the label text to nil, I set it to a blank space
cell.detailTextLabel.text = @" ";
Adjust your logic accordingly to deal with a lone blank space as nil.
For me the detail text label didn't show up even though I had a string ready for it before the viewcontroller loaded. one of my many cells shows the current date in a detail text label as default whenever the view controller appears, but that didn't work either.
I think this has something to do with the fact that the iOS 8 is not able to update the text label's text if it set to nil initially.
So see to it that you introduce a blank space in your prototype cell as well, in interface builder. Surprisingly text in labels of my custom cells are working fine.
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