0

だから私はこれUIImageViewをその上に画像で持っています。通常のiPhoneディスプレイを使用している場合、UIImageView想定どおりに正確に表示されます-境界では、問題は、Retinaディスプレイデバイスを使用している場合、画像が大きくなり、境界にUIImageView収まらないことです。UIImageView画面の上。

この問題を解決するにはどうすればよいですか? UIImageViewRetina ディスプレイの画像をサイズ内に収まるようにしたい。

これは私のコードです:

- (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;
}

少し早いですがお礼を!

4

2 に答える 2

1

コンテンツ モードをUIViewContentModeScaleAspectFit

于 2012-10-25T13:28:23.280 に答える
0

コア プロットのある画像を使用していたとき、Retina ディスプレイ用に画像をスケーリングする必要がありました。

 CPTImage *fillimage = [CPTImage imageWithCGImage:bubble.CGImage scale:bubble.scale];

画像ファイルの名前はバブルで、バブル ファイルと bubble@2x ファイルがありました。これにより、どちらのディスプレイの画像ビューにも画像が収まるようになりました。お役に立てれば。

于 2012-10-25T13:29:06.397 に答える