iPhoneで表を出力する時が多々ありますが、デフォルトのままでは、iPhoneを横に傾けたとしても、コンテンツはそれに対応しません。
向きに対応させるためには、以下のようにします。
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation { // Return YES for supported orientations return YES; } |
実行結果は、下のようになります。
まずは、オープン時

横に傾けた場合は、↓

iPhoneを傾けると確かにコンテンツも向きに対応するのですが、viewをCGRectなどを使って直で指定している場合、位置が変更しないので、向きが変わった後、コンテンツがブサイクになってしまう可能性があります。
そうなった場合のコンテンツの再配置については、また後日改めて書く予定です。
0 コメント:
コメントを投稿