2014-03-27 28 views

回答

2

要檢查設備是iPad上,你可以這樣做:

if ([UIDevice currentDevice].userInterfaceIdiom == UIUserInterfaceIdiomPad) { 
    //Setting for iPad 
} 
else { 
    //Setting for iPhone 
} 

同樣你也可以這樣做:

if ([UIDevice currentDevice].userInterfaceIdiom == UIUserInterfaceIdiomPhone) { 
    //Setting for iPhone 
} 
else { 
    //Setting for iPad 
} 
1

Settings.bundle文件是常見的程序。它不是這樣,如果你是一個通用的應用程序,而不是你可以分別爲iPhone的iPhone & iPad的文件。這將是1個通用文件。

您應該通過檢查If iPad Device是否可以打開方向或iPhone設備&鎖定方向來進行驗證。

+0

是的,我瞭解,但我們如何禁用一個項目? – SanjayPathak

+0

@ user3427687禁用意味着您只能爲iPhone設置特定方向遮罩。 – Mayur

2
BOOL isiPad; 
//Declare global Bool value 
if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad) { 
// The device is an iPad 
// Enable rotation here 
isiPad=YES; 
} 
else { 
// The device is an iPhone or iPod touch. 
// disable rotation here 
} 


//Set your rotation methods here 
-(BOOL)shouldAutorotate 
{ 

     return isiPad; 
} 
2

在項目

靶> Summery->支持的界面取向在 它給設置界面方位對iPhone和我墊分別 檢查一次

像下面的圖像 See below image

相關問題