IOS SDK Check if device is an iPhone or iPad at runtime

This is the code i use to check if the user device is an iPhone, iPhone4 or IPad. Based on this i show different screens.
[sourcecode language=”objc”]//check the device type – iphone / ipad / ipod / whatever
if ([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPhone) {
if ([[UIScreen mainScreen] respondsToSelector:@selector(scale)] == YES &&
[[UIScreen mainScreen] scale] == 2.00) {
// RETINA DISPLAY CODE
} else {
//NON RETINA DISPLAY CODE
}
} else {
//IPAD CODE HERE
}[/sourcecode]
Let me know if you have any questions. Good luck