UIImageView *subview = [[UIImageView alloc] initWithFrame: CGRectMake( 80.0, 70.0, 150, 250 )]; //设定图片名称,myPic.png已经存在,拖放添加图片文件到image项目文件夹中 [subview setImage:[UIImage imageNamed:@"关灯.png"]];
图片添加到指定大小的Frame中
UIImageView设置图片
本文介绍如何使用UIImageView显示一张名为“关灯.png”的图片。通过创建UIImageView实例并设置其frame,然后利用setImage方法加载指定图片资源。

被折叠的 条评论
为什么被折叠?



