1. new company
I’m now at visuamobile.
I’m working on software for iPhone.
2. a word on dequeueReusableCellWithIdentifier:
Did you thought – [UITableView dequeueReusableCellWithIdentifier:] was only for performance issue ?
In fact, this is mandatory when you have to call reloadData at any time.
It has some bug in the following case :
- highlight the cell by touching the cell
- reloadData on the UITableView
- then, touch up to select the cell
The UITableView will try to use the highlighted cell instance (which may have been dealloc’ed) when you touch up instead of using the new created cell.
So that this will crash.
It looks that the workaround is to use the following method of UITableView :
- (UITableViewCell *)dequeueReusableCellWithIdentifier:(NSString *)identifier
3. edit mode and reloadData
Don’t try to call – reloadData on UITableView while it is in edit mode.
This will have a buggy behavior, especially when you call reloadData while the user is touching-dragging the rows to move them.
The workaround is to call reloadData when you are back from edit mode.
4. disable move of rows
– (NSIndexPath *)tableView:(UITableView *)tableView targetIndexPathForMoveFromRowAtIndexPath:(NSIndexPath *)sourceIndexPath toProposedIndexPath:(NSIndexPath *)proposedDestinationIndexPath
if you try to return sourceIndexPath as result, this will have a bad behavior. You tableview will be broken. The dragged cell at the end of drag will be at a strange position in the tableview.
About the second thing…
I found that problem in my code. Touching down on a cell and releasing it after a reloadData was invoked on that table makes the program crash.
Didn’t found any solution, as the application crashes before tableView:didSelectRowAtIndexPath: delegate method is invoked, at any point inside the UIKit code…
Did you solve this problem?
Thanks!
Comment by Jesus — December 14, 2009 @ 5:28 pm