現在ViewControllerにshouldAutorotateを実装しているのですが呼ばれません。
shouldAutorotateを実装しているViewControllerはNavigationControllerとrelationshipがあり、そのNavigationControllerはTabBarControllerとrelationshipがあります。
そこで以下のサイトを参考にして次のようにコードを書いたのですが、それでもshouldAutorotateが呼ばれません。
[Objective-C] UIViewControllerの回転周りのまとめ
Objective
1@implementation UINavigationController (Rotation) 2 3- (NSUInteger)supportedInterfaceOrientations { 4 return [self.viewControllers.lastObject supportedInterfaceOrientations]; 5} 6 7- (BOOL)shouldAutorotate { 8 return [self.viewControllers.lastObject shouldAutorotate]; 9} 10 11@end
カテゴリの書き方がイマイチよくわかっておらず、上記のコードはshouldAutorotateを呼び出したいViewControllerの@end以降に書いているのですが、これで大丈夫でしょうか?
今のところ上記のコードのsupportedInterfaceOrientationsだけは呼ばれています。
どうすればshouldAutorotateが呼ばれるようになるでしょうか?
どなたかわかる方がいれば教えていただきたいです。よろしくお願いします。

回答1件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
2016/03/16 03:11