我有图像数组,其中包含第一张图像中的两个图像,它在图像视图上正确显示,因为我在视图中编写代码是否加载为`
NSString *urlString=[NSString stringWithFormat:@"%@",[imageArray1 objectAtIndex:i]];
NSLog(@"selected image:%@",urlString);
NSURL *url =[NSURL URLWithString:urlString];
NSData *imagedata =[[NSData alloc]initWithContentsOfURL:url];
UIImage *image=[[UIImage alloc]initWithData:imagedata];
[imgvw setImage:image];
现在我需要在单击条形按钮时显示下一个图像,该代码是`
i=i+1;
NSLog(@"i=%d",i);
NSString *urlstr=[NSString stringWithFormat:@"%@",[imageArray1 objectAtIndex:i]];
NSLog(@"selected image:%@",urlstr);
NSURL *url =[NSURL URLWithString:urlstr];
NSData *imagedata =[[NSData alloc]initWithContentsOfURL:url];
UIImage *image1=[[UIImage alloc]initWithData:imagedata];
[imgvw setImage:image1];
但是在线崩溃 `NSString *urlstr=[NSString stringWithFormat:@"%@",[imageArray1 objectAtIndex:i]];
我不明白为什么会发生请提出一些建议?