简体   繁体   English

图像已在iOS模拟器6.0中加载到UIImageView,但在5.1中未加载

[英]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.

相关问题 创建用于将加载的图像包装在UIImageView中的方法 - Creating a method for wrapping a loaded image in a UIImageView iOS 8.2升级不会在UIImageView中显示图像,而仅在通过iTunes或TestFlight加载的应用中而不是Xcode中显示图像 - iOS 8.2 upgrade not show image in UIImageView, but only in app loaded through iTunes or TestFlight not Xcode UIImageView在Xcode 6.0 iOS 7.1和更高版本中不显示图像 - UIImageView not showing image in Xcode 6.0 iOS 7.1 and Later 将图像发送到另一个视图控制器UIImageView IOS 5.1 - Send image to another view controller UIImageView IOS 5.1 iPhone:以纵向模式捕获的图像在UIImageview中以横向模式加载 - iPhone : Image Captured in portrait mode is loaded in landscape mode in UIImageview UIImageView在模拟器上显示图像,但在iPhone上不显示 - UIImageView shows image on simulator but not on iPhone 与iOS 5.1和6.0中的其他尺寸相同的文本字段 - The same textfield with other size in iOS 5.1 and 6.0 iOS 6.0 Quicklook QLPreviewController 错误:“无法找到已加载代理的预览项目” - iOS 6.0 Quicklook QLPreviewController errors with: “Cannot find preview item for loaded proxy” 在iOS中绘制加载的UIImage - Drawing into a loaded UIImage in iOS 如何在Xcode 5中添加iOS 6.0模拟器? - How to Add iOS 6.0 Simulator in Xcode 5?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM