デバイスを回転させたときにUIImageViewがフルスクリーンになるようにしたい。どうやってやるの?
1256 次
3 に答える
3
ビュー コントローラーに実装willAnimateRotationToInterfaceOrientation:...
し、向きに応じて画像ビューに必要なフレームを設定します。
- (void)willAnimateRotationToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)duration
{
if (UIInterfaceOrientationIsLandscape(toInterfaceOrientation) {
self.imageView.frame = ...
} else {
self.imageView.frame = ...
}
}
于 2012-08-10T07:35:54.880 に答える
0
そして、あなたをそのようなものに設定することを忘れないでくださいautoresizingMask
:
self.imageView.autoresizingMask = UIViewAutoresizingFlexibleHeight | UIViewAutoresizingFlexibleWidth;
そのようにすれば、フレーム調整を自分で気にする必要はありません。
乾杯
于 2012-08-10T07:40:25.547 に答える
-1
uiimageview.frame を widow.view.frame に設定し、scale to fit モードを選択します
于 2012-08-10T07:35:35.027 に答える