Reputation: 14886
I have setup custom UITableViewCell from code. In my cell, I have a "UITableViewCellAccessoryDisclosureIndicator". When highlighting the cell, it goes blue, and the accessory item turns white. So that's all good.
However, when tapped and a new view is pushed, the accessory item disappears. When I go back to the tableview the UITableViewCellAccessoryDisclosureIndicator is gone and tapping/holding down the finger on the same cell will not highlight it again.
It worked fine last week, but I simply cannot figure out what has prompted this issue suddenly. I can't see anything when I do an 'hg diff', so was hoping someone would direct me to a possible solution. If you need specific code, please let me know.
I have used atebits Fast Scrolling example code and done a lot of customization with it, but the basics (and highlighted BOOL) has remained the same.
PS. In my code, I have also noticed that the UITableViewCell does not stay highlighted when the new view is pushed. I have noticed that Apple's own example code, the cell is highlighted when the new view is pushed, and going back to the tableview the cell remains highlighted until the tableview is pushed all the way back into place. Any ideas here? Thx.
Upvotes: 0
Views: 1336
Reputation: 1
If you override "layoutSubviews" you need to call
[super layoutSubviews];
before your custom layout stuff.
Upvotes: 0
Reputation: 29160
I JUST solved this problem for myself (this A.M.)
Try, for the sake of argument, to remove the LayoutSubviews method from your cell. I have found this to wreak havoc on accessory views. I have ended up removing that method from my cells, and positioning the elements in the initialization method.
Upvotes: 1
Reputation: 60110
I'm not sure what the Fast Scrolling code is that you're referring to, but the table view cell should stay highlighted through a push and pop of a view controller, only deselecting immediately after the next controller is popped. In other words, the sequence of events should be:
If this isn't happening for you, you're probably making a call to the UITableView method deselectRowAtIndexPath:animated:
- this is the method responsible for deselecting cells in a table view programmatically. Make sure you don't have any extra calls to that method in your code.
As regards losing the disclousre indicator, make sure that your table view's data source isn't changing during a push or pop of a view controller. If the data source changes to another object that doesn't include a UITableViewCellAccessoryDisclosureIndicator in its generated cells, you won't see it when you refresh the table by pushing/popping a view, even when that cell is highlighted. (It may be diagnostically beneficial to display the table, wait a little while, then call [tableView reloadData]
and see if your accessory indicators disappear.)
Upvotes: 0