Objective c 如何在iphone的xcode中将字符串值添加到UIImage。显示的代码表示要插入到数组中的图像
如何将字符串值添加到iphone xcode中的UIImage。显示的代码表示要插入数组中的图像。如果我运行此代码,屏幕上显示的图像列表以及如果我点击图像列表中的任何一个图像,必须全屏显示。我是iphone新手,我希望有人能帮我解决这个问题。在向块追加第二个图像时,检索空值Objective c 如何在iphone的xcode中将字符串值添加到UIImage。显示的代码表示要插入到数组中的图像,objective-c,ios,cocoa-touch,uiimage,fullscreen,Objective C,Ios,Cocoa Touch,Uiimage,Fullscreen,如何将字符串值添加到iphone xcode中的UIImage。显示的代码表示要插入数组中的图像。如果我运行此代码,屏幕上显示的图像列表以及如果我点击图像列表中的任何一个图像,必须全屏显示。我是iphone新手,我希望有人能帮我解决这个问题。在向块追加第二个图像时,检索空值 NSMutableArray *images = [[NSMutableArray alloc] init]; [images addObject:@"item1.jpg"]; [images ad
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;
}
}
NSMutableArray*images=[[NSMutableArray alloc]init];
[图像添加对象:@“item1.jpg”];
[图片添加对象:@“item2.jpg”];
[图片添加对象:@“item3.jpg”];
[图片添加对象:@“item4.jpg”];
[图片添加对象:@“item5.jpg”];
[图片添加对象:@“item6.jpg”];
[图片添加对象:@“item7.jpg”];
[图片添加对象:@“item8.jpg”];
[图片添加对象:@“item9.jpg”];
对于(int y=0;y
此处图像未添加到块图像。请为我提供解决方案 用这个,请用NSArray
NSArray *images = [NSArray arrayWithObjects:[UIImage imageNamed:@"item1.jpg"],
[UIImage imageNamed:@"item1.jpg"],
[UIImage imageNamed:@"item1.jpg"],
[UIImage imageNamed:@"item1.jpg"],
[UIImage imageNamed:@"item1.jpg"],
[UIImage imageNamed:@"item1.jpg"],
[UIImage imageNamed:@"item1.jpg"],nil];
并删除此代码
NSString *imagename=[[NSString alloc]init];
imagename=[images objectAtIndex:k];
NSLog(@"image is :::%@",imagename);
设置图像后,再次使用断点检查,只需将uilabel添加到ImageView谢谢您的回答,但当我这样更改时,这里出现了一个错误::NSMutableArray*images=[[NSMutableArray alloc]init];[图像添加对象:[UIImage ImageName:@“item1.jpg”];由于未捕获的异常“NSInvalidArgumentException”而终止应用程序,原因:'***-[NSMutableArray insertObject:atIndex:]:尝试在0'***第一次抛出调用堆栈时插入nil对象:这是我遇到的错误