在Xcode中選擇一個你的目標,然後在摘要選項卡下確保你只選擇了UIpotrait方向,並且其餘所有選項都未選中,然後選擇info選項卡並在「支持的接口方向」行中看到它應該只有UIpotrait取向。現在打開你的委託文件和iOS5的這種方法可行
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation { return (interfaceOrientation == UIInterfaceOrientationPortrait); }
但這種方法已經廢棄了iOS6的覆蓋它iOS6的
- (BOOL)shouldAutorotate {
return YES;
}
- (NSUInteger)supportedInterfaceOrientations {
return UIInterfaceOrientationMaskPortrait;
} - (NSUInteger)應用:(UIApplication的*)應用supportedInterfaceOrientationsForWindow:(一個UIWindow *)窗口{
return UIInterfaceOrientationMaskPortrait;
}
- (UIInterfaceOrientation)preferredInterfaceOrientationForPresentation {
return UIInterfaceOrientationPortrait;
}
設置項目設置內支撐定向在摘要部分爲縱向只 – nsgulliver 2013-03-22 16:11:45