问题描述
我是 iphone 新手,目前我的问题是
Iam new to iphone currently my problem is
我在 6 个图像视图中显示了 6 个图像它没有在图像视图中显示图像我认为图像视图是大尺寸
i displayed 6 images in 6 image views It was not showing images in imageview I think the imageviews are in large size
我实现了这样的代码.
imageview1 = [[UIImageView alloc] init];
UIImage *img1 = [UIImage imageNamed:@"wolf.jpg"];
[imageview2 setImage:img1];
所以请给我发送此图像视图的正确代码.
so plz send me correct code for this imageview.
提前谢谢你.
推荐答案
首先,您要将图像 1 添加到 imageview 2 - 您确定吗?想这样做吗?
First of all, you're adding the image 1 to imageview 2 - are you sure you want to do this?
其次,您需要将 imagview 添加到视图层次结构中,例如将其添加到 ViewControllers 视图中,如下所示:[[self view] addSubview:imageview1]
(如果此代码为位于视图控制器类中).
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).
这篇关于如何在iphone的imageview中显示图像的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!