// detecting iOS
NSString *version = [[UIDevice currentDevice] systemVersion];
NSLog(@"Version:%@",version);
//detecting iPhone
add these line to your .h file
#define IS_IPHONE_4 (fabs((double)[[UIScreen mainScreen]bounds].size.height - (double)480) < DBL_EPSILON)
#define IS_IPHONE_5 (fabs((double)[[UIScreen mainScreen]bounds].size.height - (double)568) < DBL_EPSILON)
#define IS_IPHONE_6 (fabs((double)[[UIScreen mainScreen]bounds].size.height - (double)667) < DBL_EPSILON)
#define IS_IPHONE_6_PLUS (fabs((double)[[UIScreen mainScreen]bounds].size.height - (double)736) < DBL_EPSILON)
and use it in your .m file
if (IS_IPHONE_4)
NSLog(@"iPhone 4");
else if (IS_IPHONE_5)
NSLog(@"iPhone 5");
//detecting iPad
//detecting iPad
if ([UIDevice currentDevice].userInterfaceIdiom != UIUserInterfaceIdiomPad)
{
//code for iPad
}
//detecting apple watch
add these line to your .h file
//detecting apple watch
add these line to your .h file
#define IS_WATCH_42 (fabs((double)self.contentFrame.size.height - (double)174) < DBL_EPSILON)
#define IS_WATCH_38 (fabs((double)self.contentFrame.size.height - (double)151) < DBL_EPSILON)
and use it in your .m file
if (IS_WATCH_42)
NSLog(@"apple watch 42mm");
else if (IS_WATCH_38)
NSLog(@"apple watch 38mm");