近期公司項(xiàng)目要新增一個(gè)模塊,其中有一個(gè)界面比較特殊只支持橫屏,尋找再三參考這個(gè)文章 http://blog.csdn.net/totogogo/article/details/8002173,然后測(cè)試這個(gè)方法還不錯(cuò)。
特殊界面的類(lèi)名字為SecondVC
- (NSUInteger) supportedInterfaceOrientations{
NSInteger flag = UIInterfaceOrientationMaskAll;
if([[self topViewController] isKindOfClass:NSClassFromString(@”SecondVC”)])
return UIInterfaceOrientationMaskLandscape;
return flag;
}
- (BOOL) shouldAutorotate {
return YES;
}
橫屏問(wèn)題就得到解決了,這只是支持ios6.0的,6.0以下的版本參考上面的文章也能解決好。當(dāng)然需要使用sdk6.0開(kāi)發(fā) xcode4.5也是需要的
