Brandon
Brandon

Reputation: 1

UITableView Question?

I have a simple UITableView setup, but I want each item to contain an image. So when you click on 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.

Upvotes: 0

Views: 68

Answers (4)

Anil Kothari
Anil Kothari

Reputation: 7733

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]];

Upvotes: 0

Mahir
Mahir

Reputation: 1684

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];

Upvotes: 0

Ethan Mateja
Ethan Mateja

Reputation: 201

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.

Upvotes: 1

Daryl Teo
Daryl Teo

Reputation: 5495

You will need a UITableViewCell subclass.

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

This gives you almost what you need.

Upvotes: 0

Related Questions