Turn off split view for iPhone (all sizes), but retain split view for iPad - ios

1.) We have a universal iOS app that incorporates split view and slide-over for iPad. Just right. For iPhone, on the other hand, we do not want to use these features.
2.) Split view does not appear for smaller iPhones, even in landscape, which is the desired behavior. Just right, again. However, larger iPhones in landscape mode do by default, utilize split view, which is not the desired behavior.
3.) Split view on larger iPhones can be disabled at the user level(iOS 14): settings -> display and brightness -> view and select "Zoom". That does achieve the intended result. However, user may not find that feature desirable for all of their apps across their device. It also requires a certain level of user sophistication to figure this out. For these reasons, that is not a viable solution.
4.) There is an info.plist option called UIRequiresFullScreen, which achieves the intended result for iPhone, however it also disables split screen and slide-over for iPad, which is not the intended result. We want this only to apply to iPhone. That is therefore not a viable solution either.
Seems there is likely a simple solution to the problem of turning off split view for larger iPhones for a universal iOS app, so the larger iPhones function just like the smaller iPhones. Thoughts?

Responder dfd helped steer our thinking back on the right track. The solution is not to try to remove the iPhone splitViewController feature of iOS, but as dfd pointed out, we should embrace the feature. Thinking in splitViewController mode, rather than trying to force the larger iPhone to be a smaller iPhone, the behavior we are looking for in landscape view on larger iPhones is:
splitViewController.preferredDisplayMode = .primaryHidden
Calling this preferredDisplayMode on rotation on iPhone provides just the solution we were looking for. Thanks to all who took the time to review our question!

Related

In Xcode, why are there more/less views depending on what device is running in the simulator?

I am having an issue where aspect fill is working on iPhones, but doesn't work on iPads except for iPad 7th generation. In the process of debugging, when I looked at the "Debug View Hierarchy", I noticed that some devices had a WindowView and a UIView behind my UIImageView while others had more views such as UITransitionView, UIDropShaddowView, and one had 2 UIViews. Why is that and why is it not consistent on all devices? Thank you.
I don't know how your app is built up, but different UIKit controls can result in very different view hierarchies depending on the display size of your app. For example a UISplitViewController might end up being a simple navigation view stack (with much less views involved) on iPhone in portrait vs. an actual split view controller on iPad.
View hierarchies may also differ if you're running different OS versions across your devices, simply because implementation details of the system frameworks changed.

Landscape only on XCode 6

Hi so I've been playing around with XCode and can't seem to figure out how to make an application landscape only. Wondering if there is a simple/storyboard solution.
I've tried checking the landscape left and landscape right and unchecking the portrait on the general page under "device orientation".
However this strangely just displays the w Compact h Regular set up on my storyboard horizontally (as opposed to showing the W Any h Compact set up). I mean technically I can work around this, but it seems annoying/inefficient to rotate my head 90 degrees while working on the portrait settings.
If there is only solution in code, I would appreciate it in swift!
EDIT: Hmmm, after some testing it seems as if the phone I'm testing on only shows the rotated version of the portrait settings. It's an iPhone 4 and maybe outdated for handling 2 seperate set ups for portrait and landscape.
Thanks!
Just for anyone with this problem in the future, here's the problem:
The storyboard editor by default will display the editor as any by any, as it should. Size classes should ONLY be used when you need to change something specifically for one kind of size class (in other words, things that will be different on different devices. You should still edit everything in the any x any orientation, and regardless of if it's landscape only because size classes will still change from device to device for landscape orientation.
It's an iPhone 4 and maybe outdated for handling 2 seperate set ups for portrait and landscape
That could be it. Size Classes were invented in iOS 8. So on a system earlier than iOS 8, they are not supported, and your results will be, shall we say, unpredictable.

Scaling UIViewController and children to fit iPad or iPhone screens

I am developing a game for the app store and have been using Sprite Kit. In Sprite Kit to have the game work on both the iPhone and the iPad I set the SKScene's scaleMode=SKSceneScaleModeAspectFill and made the screen proportions so it would fit the iPhone 4&5 screens as well as the iPad and this has worked well. Now I am building the menus for the app, but I am not using Sprite Kit for this. Instead I am using Collection Views, Buttons, images, etc. I am not seeing a similar property to scale the view to a certain size depending on what device I am on. Since I am using images for all of my buttons, ideally just proportionately scaling everything would be the simplest way to achieve what I am looking for. Am I missing something as far as how best to proceed with this? Thanks in advance.
You are describing Auto Layout. It is the feature specifically designed for this very purpose, i.e. to change sizes and distances of interface objects in response to the fact that the screen is a different size.
https://developer.apple.com/library/ios/documentation/userexperience/conceptual/AutolayoutPG/Introduction/Introduction.html
However, for a size difference as great as the iPad vs. the iPhone, if you have a universal app, it sometimes makes sense to design two different interfaces. It is easy to set up the Info.plist or your initial code to load the correct interface depending on which device type this turns out to be at runtime. In fact, if you start by making a Universal app, the project will simply come with two storyboards, one for iPhone and one for iPad, which are loaded automatically.
Another option (which didn't occur to me at first because I don't write these kinds of game) is to scale a superview by applying a view transform (i.e. set its transform to a scale transform). That scales the view's coordinate system, so all its subviews will change to match, just like a drawing.

How/whether to make a universal storyboard in Xcode

When creating a storyboard file in Xcode, you must select if it is for iPhone or iPad. This implies one should always put iPhone and iPad UIs into separate storyboards. Is this true?
My app has multiple storyboards. While the Main.storyboard files largely differ between iPhone and iPad, other storyboards are nearly identical. The only difference might be segue being a push on iPhone vs popover on iPad, which can be handled programmatically. It seems awfully silly and redundant to make two storyboards.
So if making one "universal" storyboard, should iPhone or iPad be selected in Xcode? Does it matter?
As of Xcode 6, we can create a single unified storyboard for all the devices.
For more info - Documentation
iOS 8 makes dealing with screen size and orientation much more
versatile. It is easier than ever to create a single interface for
your app that works well on both iPad and iPhone, adjusting to
orientation changes and different screen sizes as needed. Design apps
with a common interface and then customize them for different size
classes. Adapt your user interface to the strengths of each form
factor. You no longer need to create a specific iPad storyboard;
instead target the appropriate size classes and tune your interface
for the best experience.
There are two types of size classes in iOS 8: regular and compact. A
regular size class denotes either a large amount of screen space, such
as on an iPad, or a commonly adopted paradigm that provides the
illusion of a large amount of screen space, such as scrolling on an
iPhone. Every device is defined by a size class, both vertically and
horizontally. iPad size classes shows the native size classes for the
iPad. With the amount of screen space available, the iPad has a
regular size class in the vertical and horizontal directions in both
portrait and landscape orientations.
Edit:
It only supports iOS 8(backward compatible applies only for iOS 7) and later.
You've got to create to separate storyboards for each kind of device. If you would delete the iPad storyboard, than your app would use the iPhone's one. You'll realize it when you'll see the 2x button at the bottom of the screen. Everything will be scaled to fit the larger screen - and the graphics would be really bad.
The only suitable workaround is to copy-paste everything from your iPhone Storyboard to iPad storyboard. Just follow the next steps:
Open iPhone.storyboard,
Press CMD+A,
Press CMD+C,
Switch to iPad.storyboard,
Press CMD+V,
You'll see, that all the screens, segues, properties and actions are transferred to your new storyboard. All that you have to do is to fix the frames of all your elements so that they'll suit new screen sizes.
And don't forget, that a good iPad application shouldn't be the same as the iPhone version. There are a lot of cool things which you can do with iPad!

iPhone app view is cut off at the botton when run on iPad

I need your help. I have designed an app to target iPhone only and everything works fine. However, I just realised that when I run it on iPad, I get black spaces around the screen (view doesn't cover full screen of the iPad) and strangely, the bottom part of the app gets cut off when it runs on iPad. How do I get full screen iPad mode without part of the view getting cut off. Thanks
This is normal behaviour(black spaces around the screen) if the value for "Devices:" under Target/deploymentInfo is set to iPhone. In this case you can still test on iPad but with iPhone resolution. (but if it set to iPad you can not test on iPhone).
if you want to get iPad resolution you have to change "Devices:" value to universal.
for (bottom cut) check if your code uses device size for positioning buttons.
Your app must also run on iPad without modification as for
2.10 App Store Review Guidelines
At first, you have to set your the view (on Main.storyboad) to fit all size. That is `wAny hAny).
Then selected the views, add some constrains to them one by one. When you run the app, it should be right. If the position doesn't match your expectation, you can change the constrains. You should know things about AutoLayout. Find some article to read, and practise.
Thanks guys for all the comments. Using your comments and reading and testing AutoLayout features, I am able to solve the problem.

Resources