简体   繁体   中英

View doesn't take up full screen on iPad

Simply that. I'm working on an iPhone (iOS) game that loads without using .xib files. Window and view is created programmatically. It automatically detects resolution and retina display and adjusts accordingly.

However when run on and iPad (only have the simulator for iPad), it shows up in a mini window that same size as the iPhone resolution, with a little 2x button in the bottom-right corner. I want it to load fullscreen with full resolution (larger res than the phone). Everything will scale accordingly so it would look the same as on the phone, and look just as crisp.

Why does this happen? Why doesn't the window automatically take up the fullscreen like it does on iPhone?

After much searching, I've found this template: https://github.com/ryanscott/rcloudlib/blob/master/Samples/clean_universal_app_template.zip

which loads properly for me on both iPhone and iPad.

Looking at the code, however, it does nothing differant than what I am doing. All it does is check which device is being used, and loads the appropriate app delegate, which in this case contain the exact same code, albeit for background color. This is clearly aimed towards those who want to have a different view load on iPhone vs. iPad, while avoiding using nibs. I want the SAME view across all devices, so I have no need to use multiple delegates or the like.

How can I force the app delegate to use the fullscreen regardless of device?

In your Xcode project file, find your target, go to the Summary tab and make sure that Devices is set to Universal under iOS Application Target

Uinversal iOS应用程序设置

Yup! In Xcode 6 the "Devices" option is now called "Deployment Target" and is located here:

在此输入图像描述

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM