我正在創建一個iPad,我想只有兩個方向:lanscape右和左(不是人像)......我已經改變了。 plist文件,但我應該寫在代碼中?目標c:代碼爲lanscaperight和landscapeleft
- (BOOL) shouldAutorotateToInterfaceOrientation: (UIInterfaceOrientation) {interfaceOrientation return?? }
我正在創建一個iPad,我想只有兩個方向:lanscape右和左(不是人像)......我已經改變了。 plist文件,但我應該寫在代碼中?目標c:代碼爲lanscaperight和landscapeleft
- (BOOL) shouldAutorotateToInterfaceOrientation: (UIInterfaceOrientation) {interfaceOrientation return?? }
試試這個方法:
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
return interfaceOrientation == UIInterfaceOrientationLandscapeLeft || interfaceOrientation == UIInterfaceOrientationLandscapeRight;
}
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
return (interfaceOrientation == UIInterfaceOrientationLandscapeRight || interfaceOrientation == UIInterfaceOrientationLandscapeLeft);
}
還有,如果你想保持一點清潔劑就可以利用方便的功能:
return UIInterfaceOrientationIsLandscape(interfaceOrientation);