开发者

UITableView Question?

I have a simple UITableView setup, but I want each item to contain an image. So when you click o开发者_开发百科n an item is goes to a image. How do you think I would do this? I have about 10 items in my list(array) that will in the TableView.


The UITableViewDataSource Protocol is a must read. Once the protocol has properly been implemented, using the tableView:didSelectRowAtIndexPath is your answer. Depending on your implementation requirements, this answer could vary slightly but the protocol remains the solution.


You will need a UITableViewCell subclass.

http://zcentric.com/2008/08/05/custom-uitableviewcell/

This gives you almost what you need.


If you haven't already done so, add a navigation controller to handle switching between the tableview and the image.

Then overwrite the tableview method :didSelectRowAtIndexPath

[self.navigationController pushViewController:theViewControllerContainingTheImage animated:YES];


Arrange the items in the tableview and in the Array After that use this in the didselectrowAtIndexPath delegate of UITableView [myImageView setimage:[picArray objectAtIndex:indexpath.row]];

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜