Has anyone else had issues with the detailText l
Confirming the problem using Xcode 6.3.2 (6D2105) OS X Yosemite 10.10.3 I made sure that the correct value was being assigned, still first time no show, second time show. cell.layoutSubviews() seemed logical to me since it appeared as if the view lacked a refresh and adding layoutSubviews() did the trick.
Having the same problem. My solution was to call [cell layoutSubviews]
before returning the cell at the end of -tableView:cellFForRowAtIndexPath
. This works for me, and I didn't find it necessary to override layoutSubviews
in the cell subclass.
I had a similar problem with a static UITableView. I change a label's text and it doesn't get updated on the screen unless I clicked on the cell or did anything to force update its views. My workaround was to call after updating the text:
tableView.reloadData()
P.S This doesn't make any sense; because this is a static table view, and I don't know why it worked, but it did!
So, I followed this tread and many others. This one lead me to what seems to be the correct answer. I hope this helps others, since this has driven me crazy since iOS 7 / 8 made some sort of changes.
My answer was to put the normal processing code in viewWillAppear and add this [self.tableview layoutSubviews] instead of [self.tableView reload data]. I think this has to do with Apple making things much more controllable in iOS 7 / 8. I struck upon that idea when reviewing some info on how cells were working.
Again, I hope this helps others resolve this annoying problem.
I think that if you need to reloadData, that means that the table data isn't loaded when its created.
You'd just need to load your data in the viewdidload (or somewhere else BEFORE the table view gets its data ) where your tableview is, and then create the cells accordingly.
Usually, i just use an array of whatever object i'm using and then use [array objectAtIndex:indexpath.row]
, which you probably know about.
Also, you ante-last paragraph has an unfinished sentence that looks important.
I have same problem with cell not updating correctly when using segue in storyboard. Tried
[setNeedsLayout] and [layoutIfNeeded]
on the view and the tableview and it is NOT working.
[self.tableView reloadData] is in viewDidAppear, as it should.
Then I tried the advice from pixbug, and it worked. But one should NOT use [layoutSubviews] directly. So I tried the ones that is adviced by the documents on the cell instead of tableView or the view.
Tried
[cell setNeedsLayout]
but this did NOT work.
Tried
[cell layoutIfNeeded]
this WORKED for me.
I put this before returning the cell.