2

UIImageView をコンテンツ モードの塗りつぶしスケールに設定したモーダル ビューを表示しています (xib 経由)。親クラスのサムネイルを使用して、モーダル ビュー クラスに UIImage を設定しています。

NSURL * finishedMovie = [self applicationDocumentsDirectory:@"FinishedVideo.mov"];
MPMoviePlayerController *player = [[MPMoviePlayerController alloc] initWithContentURL:finishedMovie];
UIImage *thumbnail = [player thumbnailImageAtTime:1.0 timeOption:MPMovieTimeOptionNearestKeyFrame];

previewScreen = [[PreviewScreenViewController alloc]initWithNibName:@"PreviewScreenViewController" bundle:nil];
previewScreen.thumbnailImage = thumbnail;
[self presentModalViewController:previewScreen animated:YES];

次に、モーダルビュークラス自体で:

- (void)viewDidLoad
{
[super viewDidLoad];
// Do any additional setup after loading the view from its nib.
previewImageBox.image = thumbnailImage;

}

問題は、ビューが表示されたときに、xib で設定されたコンテンツ モードを無視して、画像をフル サイズで挿入しているように見えることです。

このビューに戻ると、画像が UIImage ビューに正しく収まるので、これはバグのようです。

誰でも助けることができますか?

ありがとう。

4

2 に答える 2

1

OK解決しました!コードで UIImageView を手動で作成すると、うまくいくようです。

// Do any additional setup after loading the view from its nib.
//Work around to solve bug in UIToolkit where aspect ratio is ignored when view loads.
imageView = [[UIImageView alloc] initWithFrame:CGRectMake(13, 87, 294, 164)];
//Set the image to our thumbnail.
[self.view addSubview:imageView];
于 2012-04-30T15:24:06.840 に答える
0

多くの場合、clipsToBoundsプロパティが に設定されていNOます。UIImageViewこれにより、 が rect の外側でコンテンツをクリッピングするのを防ぎます。レイヤーの を設定してborderColorUIImageViewこれが実際に起こっているかどうかを確認できます。

于 2012-05-06T00:10:53.387 に答える