Landscape only on XCode 6 - ios

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.

Related

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

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!

How To Fit UITableView in the screen with AutoLayout

I am trying to fill the screen with a TableView. I've tried pinning 4 edges but it broke when I view it in different devices (iPad Pro, iPhone SE, landscape and portrait orientation). The TableView is messed up for some reasons. It shouldn't be this hard to fill that in. Did I messed up some settings in my Xcode?
If you ran the application on a real device you'll find it as you expect it to be.
And if you opened another file then came back to storyboard you'll find the preview as expected too, I think it's a bug in the UI Builder.
Note: I'm using Xcode Version 8.3.2.

Views in storyboard do not resize properly on iPhone 6

I've checked a lot of different websites and stackoverflow answers, and I'm still stuck.
I developed an app for iPhone and iPad targeting iOS 7.1. I have two storyboards, one for each device. The app only displays in portrait mode. I cannot seem to get the app to display full screen on the iPhone 6 simulator.
I've tried numerous things, I followed the advice linked here by adding a Launch Screen, setting the iPhone storyboard to auto layout and "use size classes", and . Not only does that not affect the size, but the Launch Screen doesn't seem to scale properly either. If I get it to fit the iPhone 6 it doesn't fit the iPhone 5 properly.
I've tried adding the proper launch images and I don't get any errors saying the wrong image resolution is present.
I've used the storyboard as a Launch Screen described here.
Now, when I switched to "use size classes" I could manually extend the objects in the views to match up with the size of iPhone 6 (I have not tested it for 6s) but that makes it extend past the iPhone 5 boundaries. The only thing I can think of right now is to create another storyboard and detect if it's iPhone 6, but I would really like some other ideas.
Here's what it looks like for iPhone 6:
And here's what it looks like on iPhone 5:
Best advice i can give u is
Use default size class , the classic 600x600 and then use Auto Layout
Or do the reverse, take a 3.5inch size VC and apply Auto Layout on it. Everything will present itself quite perfectly if you can apply the right constraints
Here is a link for an awesome Autolayout tutorial

UIViewController Size doesn´t work

Hi im currently developing an Universal app for iPhone, iPod and iPad. I have all view controllers in both storyboards set to Inferred. It works fine on iPhone Retina and on all iPads but when you put it in landscape mode it gets all messed upp and on the iphone 3,5 inch simulator the bottom gets cut off. How can i fix this? Do i have do create seperate view controllers for landscape mode and iphone 3,5? And the write some code that recognizes if its in landscape mode and iphone 4? I thought this worked automatically. Or have i done something wrong?
There is no quick fix/answer to your question.
Since the screen size is different while using horizontal and vertical orientations - it is simply not the same canvas and thus you will need to do some manual work to set it right.
Strategy 1.
Assuming your layout is simple - there are not too many elements and all elements can theoretically fit both horizontal and vertical screen size:
You should use auto layout from the Interface builder - Look at an excellent video from WWDC
https://developer.apple.com/wwdc/videos/
(video 406 - Taking Control of Auto Layout in Xcode 5)
In few words - you set spacers to your elements, aligning them to the end of your view (dynamically), therefore you can make your element shrink and move automatically respecting the current screen orientation.
Strategy 2.
Assuming your UI is complex and will not fit both orientations:
have a different xib file for horizontal and vertical views, this can take some time, but it is a solid solution that always looks good.
You simply need to track changes in orientation and load the appropriate xib.
Your problem will only be solved if you use Autolayouting and for that you need to go through some tutorials
Ray's Tutorial
Another Very well explained tutorial
Going through the above articles will definately help you in solving your problem

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