创建UIImageView [英] create UIImageView

查看:93
本文介绍了创建UIImageView的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何在代码中创建 UIImageView ,而不是在我的xib文件中创建?

How do I create a UIImageView in code, instead of creating it in my xib file?

推荐答案

UIImageView *someImageView = [[UIImageView alloc] initWithFrame:someRect];
someImageView.image = someImage;
[self.view addSubview:someImageView];

很简单! :D

您也可以检查苹果文档:
http://developer.apple.com/library/ios/#documentation/uikit/reference/UIImageView_Class/Reference/Reference.html < a>

You might wanna check the apple docs too: http://developer.apple.com/library/ios/#documentation/uikit/reference/UIImageView_Class/Reference/Reference.html

这篇关于创建UIImageView的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆