Blog Ranking

にほんブログ村 IT技術ブログへ

2011年5月27日金曜日

ViewControllerをiPadでは回転させて、iPhoneでは回転させないためのコード

対象のUIViewControllerのshouldAutorotateToInterfaceOrientation:interfaceOrientation:を以下のようにオーバーライドします。
一行ですむので分かりやすい。


- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
return (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad || interfaceOrientation == UIInterfaceOrientationPortrait);
}

0 件のコメント:

コメントを投稿