开发者

UITableView to another UITableView

i have in my project UIViewcontroller with UITableview, and in every cell there is a line with some text, and i want that when the user click on on of the cells the app will go to another UItableView with one cell and there开发者_开发百科 the user can edit the cell text.

it's some thing like the properties in the iphone.


You just call another view containing the tableView.

So, in didSelectRowForIndexPath, you type something like:

TableViewNumberTwo *otherView = [[TableViewNumberTwo alloc] init];
otherView.modalTransitionStyle = UIModalTransitionStyleCrossDissolve;
[self presentModalViewController:otherView animated:YES];
[otherView release]

The second view (TableViewNumberTwo) has the same functions as the first view, which contains your didSelectRowForIndexPath. That means you've got two classes (four, if you count the .h-classes), each containing the numberOfSections, numberOfRows, cellForRowAtIndexPath and didSelectRowAtIndexPath.

This might work out better then just reloading your table with new data. It also gives you an opportunity to expand the app with a navigation controller or something like that. If you really want it all cropped in one class (which I don't recommend because it'll be a big class), you have to reload the table ([tableView reloadData];) with a new dataset.

Good luck :)

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜