إذا كنت تريد أن تحترم جميع وحدات التحكم في الملاحة لدينا أعلى وحدة تحكم العرض ، فيمكنك استخدام فئة حتى لا تضطر إلى المرور وتغيير مجموعة من أسماء الفصول الدراسية.
@implementation UINavigationController (Rotation_IOS6)
-(BOOL)shouldAutorotate
{
return [[self.viewControllers lastObject] shouldAutorotate];
}
-(NSUInteger)supportedInterfaceOrientations
{
return [[self.viewControllers lastObject] supportedInterfaceOrientations];
}
- (UIInterfaceOrientation)preferredInterfaceOrientationForPresentation
{
return [[self.viewControllers lastObject] preferredInterfaceOrientationForPresentation];
}
@end
كما تشير عدد قليل من التعليقات ، هذا حل سريع للمشكلة. الحل الأفضل هو الفئة الفرعية uinavigationController ووضع هذه الأساليب هناك. يساعد الفئة الفرعية أيضًا في دعم 6 و 7.