iPad和iPhone的設置判斷

iPad開發中比iPhone上多了兩個控制器ide

1.UISplitViewConroller spa

2.UIPopoverControllerorm

這兩個控件只能在iPad上運行對象


爲了開發同時兼容 iPhone 和iPad 的應用,能夠經過 iOS 提供的 UIDevice 類,該對象的 userInterfaceIdiom 屬性返回一個UIUserInterfaceIdiom 枚舉值, 該枚舉值包含以下兩個值開發

UIUserInterfaceIdiomPhone  : 表明 iPhone 設備it

UIUserInterfaceIdiomPad      : 表明 iPad 設備io


判斷當前運行的設置代碼以下  table

// 判斷當前是否是運行在iPhone設備上class

if ([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPhone) {float

…...

}

// 適配時判斷手機的系統版本

#define iOS7   ([UIDevice currentDevice].systemVersion.floatValue >= 7.0)

相關文章
相關標籤/搜索