Running a universal app as a scaled iPhone app?

后端 未结 2 895
梦如初夏
梦如初夏 2021-01-25 14:04

I\'ve seen tons of questions and answers regarding merging an iPhone and an iPad app into an universal app, but that isn\'t what I want to do. What I am going to do is use in ap

相关标签:
2条回答
  • 2021-01-25 14:19

    This isn't possible, unfortunately. The iPad will know that the app is iPad ready and will tell draw the screen at full size. Even if you showed iPhone xib file on the iPad, they would still be scaled to fit the full screen using the UIViewAutoresizingMask params you've set for them.

    One thought would be to force the size of your UIWindow to be iPhone sized (remember to account for retina) and centered, but I'm not 100% sure how/if this would work. You may have to change each UIView frame. I'm not sure.

    0 讨论(0)
  • 2021-01-25 14:34

    The Info.plist file in an iOS app contains a key, UIDeviceFamily, which lists the devices that the app natively supports. If the key's value is 1, or a array containing 1, the app natively supports iPhones and iPods Touch. If the value is 2, or a array containing 2, the app natively supports iPads.

    If UIDeviceFamily says the app supports iPads, then it will run the app in native iPad mode, not in iPhone-wrapper mode.

    The Info.plist file is part of your app bundle, and you can't modify files in the app bundle.

    So there is no way to enable or disable the system's native-iPad support at runtime. You'll have to move your app's top-level view into a wrapper view that centers and scales its child, and use that wrapper view as the UIWindow's subview.

    UIDeviceFamily in the Information Property List Key Reference

    0 讨论(0)
提交回复
热议问题