开发者

changing image dynamically in iPhone application

开发者 https://www.devze.com 2022-12-12 00:53 出处:网络
My problem is, I have table of names. And when I touch on each name, a开发者_StackOverflow中文版 new view should appear and image of corresponding name.

My problem is, I have table of names. And when I touch on each name, a开发者_StackOverflow中文版 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.


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


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

0

精彩评论

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