Cocoaメモ

Appleプラットフォームでの開発メモ

iOS 6 のAuto Rotation

第47回 Cocoa勉強会関西で、
iOS 6 のAuto Rotation』について発表しました。

スライドの補足

window.rootViewController必須

window.rootViewControllerが設定されていない場合うまく動きません。rootViewControllerはiOS 4から追加されたプロパティです。iOS 4以前はviewController.viewをwindowにaddSubviewするコードを書いていましたが、iOS 4以後はrootViewControllerを利用するべきです。(rootViewControllerを設定するとaddSubviewも自動で行われます)

supportedInterfaceOrientationsForWindow: のデフォルト実装

UIApplication.supportedInterfaceOrientationsForWindow: のリファレンスにはデフォルト実装ではInfo.plistのUIInterfaceOrientationの値が参照されるとありますが、これはUISupportedInterfaceOrientationsの誤りのようです。
スライド中の表ではUISupportedInterfaceOrientationsと記載し直しましたが、同ページにあるリファレンスからのコピペはUIInterfaceOrientationのままになっていますのでご注意ください。