Since I don't have iPad 2, I need to know what it returns when calling [[UIDevice currentDevice] model]. I thought it returns just "iPad" but it seems I'm wrong.
Can somebody let me know?
Thanks
Check for an iPad with a camera.
BOOL isIPad2 = (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad &&
[UIImagePickerController isSourceTypeAvailable: UIImagePickerControllerSourceTypeCamera]);
Note that it is generally better to detect specific features rather than make blanket assumptions based on model/version detection. For instance, if you need a camera, then test for the camera explicitly; if you need to tweak the UI quality based on the amount of RAM available, test for physical RAM; etc. Also note a comment I wrote that highlights the dangers of using model detection.
Never use the model
property for anything else than displaying it for informational purposes or diagnostics output. It is not guaranteed to be preserved and if you rely on it, you unnecessarily cut off new devices as they come.
Lots of iPhone apps could not be used in the compatibility mode of iPad just because they checked the model
property and if it wasn't iPhone / iPod they didn't do anything.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With