[英]how to display images in imageview in iphone
Iam new to iphone currently my problem is 我目前的新问题是iphone
i displayed 6 images in 6 image views It was not showing images in imageview I think the imageviews are in large size 我在6个图像视图中显示6个图像它没有在imageview中显示图像我认为图像视图是大尺寸的
i implement code like this. 我实现这样的代码。
imageview1 = [[UIImageView alloc] init];
UIImage *img1 = [UIImage imageNamed:@"wolf.jpg"];
[imageview2 setImage:img1];
so plz send me correct code for this imageview. 所以PLZ发给我这个imageview的正确代码。
Thank u in advance. 提前谢谢你。
bgImage = [[UIImageView alloc] initWithFrame:CGRectMake(0,0,480,300)];
bgImage.image = [UIImage imageNamed:@"Default.png"];
[self.view addSubview:bgImage];
Also check have you add image file to your project, by Add - > Existing File 还要检查是否已通过添加 - >现有文件将图像文件添加到项目中
First of all, you're adding the image 1 to imageview 2 - are you sure you want to do this? 首先,您将图像1添加到imageview 2 - 您确定要这样做吗?
Secondly, you need to add the imagview to the view hierarchy, for example by adding it to a ViewControllers view, like this: [[self view] addSubview:imageview1]
(If this code is situated within the View Controller class). 其次,您需要将imagview添加到视图层次结构中,例如将其添加到ViewControllers视图中,如下所示:
[[self view] addSubview:imageview1]
(如果此代码位于View Controller类中)。
imageview1 = [[UIImageView alloc] init];
imageview1.image = [UIImage imageNamed:@"wolf.jpg"];
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.