如何在iPhone中的imageview中显示图像
我是 iPhone 新手,目前我的问题是
我在 6 个图像视图中显示了 6 个图像它没有在 imageview 中显示图像我认为 imageview 尺寸很大
我实现了这样的代码。
imageview1 = [[UIImageView alloc] init];
UIImage *img1 = [UIImage imageNamed:@"wolf.jpg"];
[imageview2 setImage:img1];
所以请向我发送此图像视图的正确代码。
提前谢谢你。
Iam new to iphone currently my problem is
i displayed 6 images in 6 image views It was not showing images in imageview I think the imageviews are in large size
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.
Thank u in advance.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
另请检查您是否将图像文件添加到您的项目中,通过添加 - >现有文件
Also check have you add image file to your project, by Add - > Existing File
首先,您要将图像 1 添加到 imageview 2 - 您确定要执行此操作吗?
其次,您需要将 imagview 添加到视图层次结构中,例如将其添加到 ViewControllers 视图中,如下所示:
[[self view] addSubview:imageview1]
(如果此代码位于查看控制器类)。First of all, you're adding the image 1 to imageview 2 - are you sure you want to do this?
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).