散歩しながら 〜〜アプリ開発〜〜

Mac mini 始めました [objective-c]

iPadでモーダルビューを表示する方法

さんぽです。。

 

iPadでモーダルビューを表示する場合、ちょっとだけiPhoneとは異なります。

 

UIViewController *vcModal = [[UIViewController alloc] init];

[vcModal setModalPresentationStyle:UIModalPresentationPageSheet];

[self presentViewController: viewController animated:YES completion: nil];

 

 二行目のsetModalPresentationStyleが異なる箇所です。

表示する画面領域を指定します。

 

・UIModalPresentationCurrentContext

 親と同じサイズ

 

・UIModalPresentationFullScreen

 フルスクリーン

 

・UIModalPresentationPageSheet

 幅が768ポイント、高さは今の高さ

 

・UIModalPresentationFormSheet

 540×620ポイント

 

となるそうです・・・。