Can I use the following code to detect if my app is running on iPad? My app needs to run on iOS 3.0 or higher.
if([[[UIDevice currentDevice] model] isEqualToString:@"iPad"]){
//Do iPad stuff.
}
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Use the
UI_USER_INTERFACE_IDIOM()macro on iOS >= 3.2:On earlier versions of iOS, you can fall back to your code, namely this:
This approach is forward-compatible in the sense that if next year Apple released a different iPad, the model name might change, but the word “iPad” will definitely be somewhere inside the string.