图像确实看起来都是“有效的”。您可能需要仔细检查您正在使用的库并检查拼写错误。在一个快速演示应用程序中,我执行了以下操作:
- (void)viewDidLoad
{
[super viewDidLoad];
// Do any additional setup after loading the view, typically from a nib.
UIImageView* image1 = [[UIImageView alloc]initWithFrame:CGRectMake(0, 0, 320, 200)];
image1.image = [UIImage imageWithData: [NSData dataWithContentsOfURL:[NSURL URLWithString:@"https://s3.amazonaws.com/doodlestash/doodles/20/original.jpg"]]];
UIImageView* image2 = [[UIImageView alloc]initWithFrame:CGRectMake(0, 200, 320, 200)];
image2.image = [UIImage imageWithData: [NSData dataWithContentsOfURL:[NSURL URLWithString:@"https://s3.amazonaws.com/doodlestash/doodles/20/thumb.jpg"]]];
[self.view addSubview:image1];
[self.view addSubview:image2];
}
我最终得到了这个: