How to add the String value to the UIImage in xcode,iphone .The code shown represents the images to be inserted in an array.If i run this code,the list of images to be displayed on the screen and if i tap any one image among the list of images must shown to a full screen.Am new to iphone ,I hope some one help me out with this problem .when appending the second image to the block,retrieving null value
NSMutableArray *images = [[NSMutableArray alloc] init];
[images addObject:@"item1.jpg"];
[images addObject:@"item2.jpg"];
[images addObject:@"item3.jpg"];
[images addObject:@"item4.jpg"];
[images addObject:@"item5.jpg"];
[images addObject:@"item6.jpg"];
[images addObject:@"item7.jpg"];
[images addObject:@"item8.jpg"];
[images addObject:@"item9.jpg"];
for (int y = 0; y < rows; y++) {
for (int x = 0; x < columns; x++) {
CGPoint blockOrigin = CGPointMake(x * blockSize.width, y * blockSize.height);
CGRect blockFrame;
blockFrame.size = blockSize;
blockFrame.origin = blockOrigin;
NSString *imagename=[[NSString alloc]init];
imagename=[images objectAtIndex:k];
NSLog(@"image is :::%@",imagename);
// UIImage *blockimg=[[UIImage alloc]init ];
UIImage * blockImage = [UIImage imageNamed:[images objectAtIndex:k]];
NSLog(@"block image is %@",blockimg);
TouchImageView * tiv = [[TouchImageView alloc] initWithFrame:blockFrame];
[[tiv internal] setImage:blockimg];
[self.view addSubview:[tiv autorelease]];
k=k+1;
}
}
Here image is not added to the blockImage.Please give me solution for this.
use this , please use NSArray
and remove this code
and again check with breakpoint