2011-03-30 32 views
0

我正在創建一個iPad,我想只有兩個方向:lanscape右和左(不是人像)......我已經改變了。 plist文件,但我應該寫在代碼中?目標c:代碼爲lanscaperight和landscapeleft

- (BOOL) shouldAutorotateToInterfaceOrientation: (UIInterfaceOrientation) {interfaceOrientation return?? }

回答

0

試試這個方法:

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation 
{ 
    return interfaceOrientation == UIInterfaceOrientationLandscapeLeft || interfaceOrientation == UIInterfaceOrientationLandscapeRight; 
} 
1
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation { 
    return (interfaceOrientation == UIInterfaceOrientationLandscapeRight || interfaceOrientation == UIInterfaceOrientationLandscapeLeft); 
} 

還有,如果你想保持一點清潔劑就可以利用方便的功能:

return UIInterfaceOrientationIsLandscape(interfaceOrientation);