判斷iOS6/iOS7, 3.5inch/4.0inch – iPhone手機開發技術文章 iPhone軟體開發教學課程

Retina (3.5/4 inch Screen) or Non-Retina 判斷

if ([[UIScreen mainScreen] respondsToSelector:@selector(scale)]) {
    if ([[UIScreen mainScreen] scale] == 2.0) {
       if([UIScreen mainScreen].bounds.size.height == 568){
          // iPhone retina-4 inch
        } else{
         // iPhone retina-3.5 inch
        }
}
else {
    // not retina display
}

iOS6/iOS7 判斷


NSString *ver = [[UIDevice currentDevice] systemVersion];
 float ver_float = [ver floatValue];
 if (ver_float >= 7.0)
 {
    //iOS >=7
 }
 else{
    //iOS <7
  }

發佈留言