srikanth rongali
srikanth rongali

Reputation: 1453

changing image dynamically in iPhone application

My problem is, I have table of names. And when I touch on each name, a new view should appear and image of corresponding name. For all the names only one view should be there and the image should change dynamically.

Thank You.

Upvotes: 0

Views: 529

Answers (2)

kmcgrady
kmcgrady

Reputation: 58

If you have a view controller with an UIImageView. Then I'd make the UIImageView a property:

@property (nonatomic, retain) UIImageView *myImageView;

Then in the didSelectCellAtIndexPath method for the tableview delegate, you set the image property to the image view depending on the cell selected.

myViewController.myImageView.image = [UIImage imageNamed:@"myImageName"];

Upvotes: 2

bpapa
bpapa

Reputation: 21517

Read Navigating a Data Hierarchy with Table Views in the Apple docs.

Upvotes: 1

Related Questions