Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

UI_USER_INTERFACE_IDIOM() always returns UIUserInterfaceIdiomPhone on iPad 4.3 Simulator?

I am new to iOS development and following along with the book "Learning Cocos2d, A Hands-on Guide to Building iOS Games with Cocos2d, Box2d, and Chipmunk".

I have noticed that the UI buttons and viking characher I have rendered in chapter 2 do not match the book... the apparent cause is that the book instructs you to use the UI_USER_INTERFACE_IDIOM() macro to determine whether you are running an iPad or an iPhone, but it appears that no matter whether I set the scheme in xcode to use iPad 4.3 or iPhone 4.3, the macro always reports that I am running on the phone, not the pad.

Is there some sort of problem with the macro? Is this because I am running only on the simulator? I do not have an actual device on which to test any of this. What am I to do when this macro fails like this?

like image 454
scriptocalypse Avatar asked Sep 25 '11 18:09

scriptocalypse


1 Answers

You need to make sure that your project is configured to build a "Universal" app. An iPhone app running on the iPad will still identify its UI idiom as "iPhone".

like image 63
Ole Begemann Avatar answered Sep 18 '22 04:09

Ole Begemann