未経験からのiPhoneアプリ開発blog

iPhoneアプリ開発の独学をしています。学習した内容をメモ的に記録していきます。

『iPhoneアプリ開発塾』chapter6-3

画面を回転させるUIInterfaceOrientationを学習しました。

 

今日からiOS7、Xcode5.0にアップデートされている関係なのか、本書のサンプルコード通りではエラーになってしまうという現象がありました。

 

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)InterfaceOrientation

これの最後"InterfaceOrientation"Xcodeでは"toInterfaceOrientation"でした。

 

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation

 

それに伴って、以下のコードも変わります。

return (toInterfaceOrientation == UIInterfaceOrientationPortrait

|| nterfaceOrientation == UIInterfaceOrientationLandscapeLeft

|| InterfaceOrientation == UIInterfaceOrientationLandscapeRight

|| InterfaceOrientation == UIInterfaceOrientationPortraitUpsideDown

 

);

これはこうなります。

return (toInterfaceOrientation == UIInterfaceOrientationPortrait

|| toInterfaceOrientation == UIInterfaceOrientationLandscapeLeft

|| toInterfaceOrientation == UIInterfaceOrientationLandscapeRight

|| toInterfaceOrientation == UIInterfaceOrientationPortraitUpsideDown

 

);

 

また、以下のコードを入れたままにすると逆にエラーになりました。

UIInterfaceOrientation toInterfaceOrientation = self.interfaceOrientaiton;

削除すると、ビルド成功しました。

 

これは、iOSXcodeのアップデートによるものなのか、どうなのか。不明です。

 

※本書で勉強中!

iPhoneアプリ開発塾
出版社: 技術評論社 (2012/6/8)
Amazon.co.jp 詳細ページへ