Reputation: 3433
I am new to iPhone. What i need is i have to assign image name (eg.parrot.jpg) to NSString value.i need to display image in imageview using this string variable.
apporxmatly imageview.image = NSStringvarible;
where NSStringVArible is image name.
How can i done this?
Upvotes: 0
Views: 971
Reputation: 1757
NSString *imageName = @"parrot.jpg";
UIImageView *view = [[UIImageView alloc]initWithImage:[UIImage imageNamed:imageName]];
Upvotes: 2
Reputation: 9740
You can use
imageview.image = [UIImage imageNamed:NSStringvarible];
as imageview.image needs image and not simple string... So you line will give you warning and will terminate the application Use the above line will help you solve the problem...
hAPPY iCODING...
Upvotes: 0