1

私のアプリは主に iOS6+ をサポートしています。iOS5について検討した際、以下の判断を加えました。

 if ([[[UIDevice currentDevice] systemVersion] floatValue] >= 6.0) { 
    self.modalPresentationStyle = UIModalPresentationFullScreen;
    [self presentViewController:readerViewController animated:YES completion:NULL];
 }
 else {
    self.modalPresentationStyle = UIModalPresentationFullScreen;
    [self presentModalViewController:readerViewController animated:YES];
}

ただし、モーダル ビューは横向きのアプリで垂直に表示されます。つまり、私のアプリは横向きで、モーダルビューはそこに「横たわる」だけで、設定したフルスクリーンではなく、画面の一部をカバーするだけで、カバーされていない部分は黒です。

誰か助けてくれませんか。よろしくお願いします。

4

2 に答える 2

1

Lilac :- ティアの言ったことは正しい。バージョンについて心配する必要はありません。必要なビューの向きで ModalView の向きを設定していないと思います。

つまり、mainViewController (ModalView を表示している元) がランドスケープ モードのみをサポートしている場合、modalViewController で方向を設定し、ランドスケープ ビューでのみ表示するように制限する必要があります。

mainViewController に記述した Orientation コードを modalViewController にも記述する必要があります。

これらの方法:-

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
    // Return YES for supported orientations
    return (interfaceOrientation == UIInterfaceOrientationLandscapeRight || interfaceOrientation == UIInterfaceOrientationLandscapeLeft);
    //    return YES;

}

-(BOOL)shouldAutorotate{
    return YES;
}

-(NSUInteger)supportedInterfaceOrientations{
    return UIInterfaceOrientationMaskLandscape;
}

問題が解決しない場合は元に戻してください。問題が解決する場合は、何をすべきかがわかります;)。

于 2013-06-04T08:57:43.843 に答える
0

まず、iOS 5.0presentViewController:animated:completion:から利用できるので、バージョンを気にする必要はありません。メソッドの可用性を本当に確認したい場合は、使用する必要があります

if ([self respondToSelector:@selector(presentViewController:animated:completion:)])

モーダルビューの場合、たとえばあなたの場合modalTransitionStyle提示されたコントローラーmodalPresentationStyleを設定する必要があります。だからあなたのコードはreaderViewController

readerViewController.modalTransitionStyle = UIModalPresentationFullScreen;
readerViewController.modalPresentationStyle = UIModalPresentationFullScreen;
[self presentModalViewController:readerViewController animated:YES completion:NULL];
于 2013-06-04T05:50:46.393 に答える