I've been working on my first iPad based project which has proven a massive learning curve but I'm nearly there. I have a small issue left however.
I've got my iPad to work in all orientations as dictated by Apple however they keyboard always comes on from the Portrait position unless the user rotates the device first. Does anyone have any suggestions where this is coming from? Just can't seem to figure out the reasoning for it. Any thoughts much appreciated, I'm sure this is glaringly simple but I'm just pulling my hair out here.
The keyboard displays based on the device's true orientation regardless of the layout any views. If the device is in portrait, the keyboard displays in portrait and it will not change until the device is physically rotated to landscape.
Related
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!
I'm trying to draw a line from the bottom middle to the center of the screen. The values I was using for my two points seemed really odd so I knew something was off. I changed the aspect mode to aspectFit to see what was happening and lo and behold my view seemed to be in portrait even though my app specifies landscape. Does anyone know what is causing this? In the build settings I have only landscape checked.
My app needs to somehow mimic the iOS original Camera App, that even the device's AUTOROTATE is locked, the ViewController or specifically the AVCaptureVideoPreviewLayer will rotate.
So far, what I did to my project is this: Check the Landscape (right and left) in Project Properties/Settings, and then tweak each View Controllers' shouldAutorotate.
Everything is fine using this technique, until the user lock his device autorotate function (in iPAD this is a button at the side of the device, in iPhone this can be found in the settings from below the screen).
I couldn't find any answered related question on stackoverflow, so I asked.
So after few days, I have solved the problem!!! I'm still wondering though what was the reason behind in down voting my question. I have found this tutorial/blog:
Detect Device Rotation Even When Rotation Lock Is ON
So basically, the alternative way is to use CoreMotion. I hope someone who is having the same question in mind finds this answer. Cheers!
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.
Since a few years back I have a "iPhone is the controller, game screen displayed on TV by way of Apple TV and Air Play" project slowly going. It's like a space-shooter-maze kind of game, except there is no shooting and the objective is to steer a spaceship to find the boss (which is a pic of my then ~1 year old son). Like a NES game without the NES.
Now when I run the stuff for the first time in like a year or so, the controller, which is basically using a SpriteKit scene down the line, is tilted 90 degrees in the right OR left direction. The "OR" depends on what orientation my iPhone 6 Plus is in when the app starts. So the game only takes up half of the tv screen now - because it's tilted - and even a lay man can see that something fishy is going on because the text is not the normal horizontal text you are reading now, it's tilted.
Did something change recently, like with iOS 8 and how hooking up additional UIScreen:s work? I rarely touch this project, so I forget how everything work most of the time I do something with it again after a long hiatus. Anyone experienced this and know where to start digging?
Poking around, it seems that the app itself and what is displayed on the handheld device/controller (the iPhone) must/should be portrait only. If the app is launched in landscape mode, the screen display on the tv will also be "tilted", without the tv itself being tilted... and things get out of order. I set portrait only just by clicking around in the target->device orientation checkboxes.
This is kind of unwanted because the a normal video game controller is held in a landscape position and this was the way I always used it. I don't know what made this work differently, maybe it's the iPhone 6 Plus with landscape support at the home screen level, or maybe iOS 8 or whatever.
So there are basically two options here.
Design the controller as portrait, but already in the design put everything tilted. The bottom left steering cross would have to be put top left, tilted 90 degrees to the right for a fake "landscape right" setting. Might be less of a pain than doing the same thing to the tv screen instead.
Continue with the use of real landscape mode for the controller, and use some anti-tilt rotation by setting a new rotated transform of the tv controller's view's transform. (I tried this, it seemed like it needed a translation as well, so I gave up. Still might work.)
Update: I found a better solution:
Allow landscape right, landscape left AND portrait rotations of the app. (In that order, if you intend to launch the controller in landscape mode - but portrait has to be in there.)
In the subclass of UIViewController that controls what's going on upon your tv, return UIInterfaceOrientationMaskPortrait in supportedInterfaceOrientations. The tv controller must be run in "portrait" mode, which for a tv controller would mean the "default" mode, which for the eye looks like the normal landscapish mode. A landscaped tv controller would mean a tilted view, and we don't want that. Yes this is weird but maybe logical. Oh, and in the subclass of UIViewController for the hand controller, I return UIInterfaceOrientationMaskLandscape so as not to support portrait mode. The user likely launches the controller in portrait mode (especially on any iPhone other than 6 Plus) and if we supported that he/she would maybe think the controller can only be used in portrait mode, and that is very inconvenient when playing video games.