you can easly detect iphone, iphone5 and iPad with below condition (But not iTouch! iTouch is treated as if it were an iPhone with this code!):-
if([[UIDevice currentDevice]userInterfaceIdiom]==UIUserInterfaceIdiomPhone)
{
if ([[UIScreen mainScreen] bounds].size.height == 568)
{
}
else
{
//iphone 3.5 inch screen
}
}
else
{
//[ipad]
}
UPDATE
You can also use MACRO or define Variable for check is that iPhone5,iPhone4 or iPad like Bellow:-
#define isiPhone5 ([[UIScreen mainScreen] bounds].size.height == 568)?TRUE:FALSE
#define isiPhone (UI_USER_INTERFACE_IDIOM() == 0)?TRUE:FALSE
Example:-
if(isiPhone)
{
if (isiPhone5)
{
}
else
{
//iphone 3.5 inch screen
}
}
else
{
//[ipad]
}
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…