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

最佳答案

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

关于objective-c - 创建UIImageView,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/7891613/

10-16 23:34