圖像我有一些圖片,我需要從網上獲得。只需使用來自網址的數據。
他們需要在Retina顯示屏上正確顯示。
當我從網上的圖片,他們仍然看起來是像素化。我需要將圖像的縮放比例設置爲視網膜顯示(2.0),但我必須缺少一些東西。 這是我到目前爲止所做的。Retina顯示屏從URL
UIImage *img = [UIImage imageWithData:[NSData dataWithContentsOfURL:@"http://www.msdomains.com/tmp/test.png"];
CGRect labelFrame = CGRectMake(0,0,64,64);
UIImageView *imageView = [[UIImageView alloc] initWithFrame:labelFrame];
imageView.contentScaleFactor = [UIScreen mainScreen].scale;
[imageView setImage:img];
[self addSubview:imageView];
[imageView release];
這是真的嗎? – Ali 2012-11-20 15:22:49
對我不起作用 – 2012-11-23 03:51:48
這是個玩笑嗎? – deadlock 2014-03-01 15:13:22