Determine if iPad or iPhone

At the time of the development process, often encounter the situation to determine the type of device, especially when the need to develop a iphone and ipad compatible equipment. Specific practices are as follows:


/ / Do this purpose, in fact, a different layout for iphone and ipad. This is more use of the characteristics of the different devices.


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

[self setupMainView_iPhone];


else {

[self setupMainView_iPad];