In Swift:
if UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiom.Pad {
In Objective-C:
if(UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad)
To check if you are running on an iPhone:
In Swift:
if UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiom.Phone {
In Objective-C:
if(UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPhone)