UI_USER_INTERFACE_IDIOM () always returns UIUserInterfaceIdiomPhone on iPad 4.3 Simulator?

I am new to iOS development and follow along with the book Learning Cocos2d, A Practical Guide to Creating iOS Games with Cocos2d, Box2d, and Chipmunk.

I noticed that the user interface and viking buttons that I presented in chapter 2 do not correspond to the book ... the obvious reason is that the book instructs you to use the UI_USER_INTERFACE_IDIOM () macro to determine if you are using an iPad or iPhone, but it looks like no matter if I install the circuit in xcode to use iPad 4.3 or iPhone 4.3, the macro always tells me what I'm running on the phone, not on the pad.

Is there any kind of problem with the macro? Is it because I only work on a simulator? I do not have a real device on which to test this. What should I do when this macro fails?

+6
source share
1 answer

You need to make sure that your project is set up to create a โ€œuniversalโ€ application. The iPhone application running on the iPad will still identify its interface idiom as โ€œiPhone.โ€

+17
source

Source: https://habr.com/ru/post/898017/


All Articles