だから私はこれUIImageView
をその上に画像で持っています。通常のiPhoneディスプレイを使用している場合、UIImageView
想定どおりに正確に表示されます-境界では、問題は、Retinaディスプレイデバイスを使用している場合、画像が大きくなり、境界にUIImageView
収まらないことです。UIImageView
画面の上。
この問題を解決するにはどうすればよいですか? UIImageView
Retina ディスプレイの画像をサイズ内に収まるようにしたい。
これは私のコードです:
- (UIImage *)loadScreenShotImageFromDocumentsDirectory
{
UIImage * tempimage;
NSArray *sysPaths = NSSearchPathForDirectoriesInDomains( NSDocumentDirectory, NSUserDomainMask, YES );
NSString *docDirectory = [sysPaths objectAtIndex:0];
NSString *filePath = [NSString stringWithFormat:@"%@/MeasureScreenShot.png", docDirectory];
tempimage = [[UIImage alloc] initWithContentsOfFile:filePath];
return tempimage;
}
- (void)viewDidLoad
{
// Setting the image
UIImage * Image = [self loadScreenShotImageFromDocumentsDirectory];
theImageView.frame = CGRectMake(0, 166, 290, 334);
theImageView.contentMode = UIViewContentModeCenter;
theImageView.image = Image;
}
少し早いですがお礼を!