iPhone Development: UITableView nib Hell
06/04/08 09:21 Filed in: iPhone SDK
I have seeminly come across some UITableView bugs
when the table view is created by loading them from
a nib file. Well, that is what I believe at the
time of this writting. Since is this all new, I may
have something wrong causing me the problems.
The gist of the problem is, once the UITableView has been displayed with some cells, when I try to change the state of the cell by using UITableViewDelegate protocols, implemented in my UIViewController for the table view, noting happens. If I try to deselect, reload the data in the view with new data, it just doesn't show up.
For example, making this call doesn't actually visually deselect, but does actually deselect internally, meaning there is not selection in the UITableView.
[(UITableView*)self.view deselectRowAtIndexPath:selectedRowPath animated:animated];
If I want to reload the view with a different set of cell data and I do the following.
- (void)viewWillAppear:(BOOL)animated
{
self.title = [self categoryToShowInTable];
[(UITableView*)self.view reloadData];
}
All the table vie delegates get called such as cellForRowAtIndexPath, but the view as displayed doesn't show the new items.
It almost seems to me that I have something very wrong, and it is causing me this behavior. If that is the case I'll update this entry with the solution.
The gist of the problem is, once the UITableView has been displayed with some cells, when I try to change the state of the cell by using UITableViewDelegate protocols, implemented in my UIViewController for the table view, noting happens. If I try to deselect, reload the data in the view with new data, it just doesn't show up.
For example, making this call doesn't actually visually deselect, but does actually deselect internally, meaning there is not selection in the UITableView.
[(UITableView*)self.view deselectRowAtIndexPath:selectedRowPath animated:animated];
If I want to reload the view with a different set of cell data and I do the following.
- (void)viewWillAppear:(BOOL)animated
{
self.title = [self categoryToShowInTable];
[(UITableView*)self.view reloadData];
}
All the table vie delegates get called such as cellForRowAtIndexPath, but the view as displayed doesn't show the new items.
It almost seems to me that I have something very wrong, and it is causing me this behavior. If that is the case I'll update this entry with the solution.
|