我已经编写了用于设置 imageview 的代码...根据单击的按钮...但我的问题是当我按下按钮时它给了我这样的错误...函数 ImageNamed 的参数太多...在执行这一行时...
UIImage* photo = [UIImage imageNamed"robort %d.jpg",x];
整个代码是....
-(void)buttonClickedUIButton*)button
{
NSLog(@"%d",button.tag);
int x;
x=button.tag;
// Create the image view.
UIImage* photo = [UIImage imageNamed"robort %d.jpg",x];
NSLog(@"%d",x);
CGSize photoSize = [photo size];
UIImageView *imageView = [[UIImageView alloc] initWithFrame:CGRectMake(0.0, 0.0, photoSize.width, photoSize.height)];
[imageView setImage:photo];
[self.view addSubview:imageView]; }
使用 UIImage* photo = [UIImage imageNamed:[NSString stringWithFormat"robort de nero%d.jpg",x]];
干杯
关于iphone - 在iphone的imageView中设置图像时出错,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5632735/
欢迎光临 OGeek|极客世界-中国程序员成长平台 (http://jike.in/) | Powered by Discuz! X3.4 |