[英]image is loaded to UIImageView in iOS simulator 6.0, but in 5.1 it is not loaded
did anyone encounter this problem? 有没有人遇到这个问题?
here's the code in ViewController.m. 这是ViewController.m中的代码。 I have a UIImageView in the XIB file attached to IBOutlet named "imageView" 我在附加到IBOutlet的XIB文件中有一个UIImageView,名为“ imageView”
-(void)viewDidLoad
{
[super viewDidLoad];
NSURL *url = [NSURL URLWithString:@"http://www.google.co.il/images/nav_logo114.png"];
NSData *data = [NSData dataWithContentsOfURL:url];
self.imageView = [self.imageView initWithImage:[UIImage imageWithData:data]];
}
instead of 代替
self.imageView = [self.imageView initWithImage:[UIImage imageWithData:data]];
do this: 做这个:
self.imageView.image = [UIImage imageWithData:data];
and don't forget to @synthesize imageView
并且不要忘记@synthesize imageView
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.