Tuesday, 27 August 2013

Assign string value as a image name

Assign string value as a image name

i have one string variable(imageStr) in which i have name of image i am
fetching from sqlite database, i want to assign that string variable as a
image name to one imageview. so how can i do it? below is my code,
UIImageView *imageHolder = [[UIImageView alloc]
initWithFrame:CGRectMake(150, 11, 50, 25)];
UIImage *image = [UIImage imageNamed:imageStr];
imageHolder.image=image;
NSLog(@"image in mediView:%@",imageHolder.image);
here in log i am getting NULL value. but if i print just "imageStr" then
it is giving me value. please help me out. Thanks:)

No comments:

Post a Comment