I need some help regarding the following.
Currently in my app I have a screen that reproduces audio files, the current layout shows a thumbnail at the top of the screen plus playback controls at the bottom. Now when it's rotated to landscape mode, the image should not stretch and the bottom controls should jump to the right of it. How could I do this using Autolayout? Do you know any example of something similar done programatically by adding/removing contraints where I can guide?.
Thanks a lot.
Related
How can I remove the white bar at the bottom of my mobile app? I've tried the solution of adding a Launch screen in the Launch screen file but that didn't work. I've attached an image.
Just for a bit of context, I'm using a PageViewController to slide between 3 pages.
Any help appreciated.
It looks like you add static size view on the iPhone 6 screen in xcode UI constructor but launch it on the iPhone 6s Plus (with bigger screen).
To scale this view properly you should turn on Use Auto Layout in the Utilities bar and add constraints to the view
Make sure that the blue-colored view is properly constrained to the bottom of its superview.
Is it possible to use a vertical stack view when the device is in portrait mode, but switch to a horizontal stack view when the device is orientated to landscape mode, to make best use of space.
Click the small plus button in the attributes inspector to add a variation, in this screenshot I already added one to switch to horizontal when regular width.
See a preview by changing the screen options at the bottom of the storyboard.
Use Auto Layout to design UI, orientation will be taken care of automatically.
See a tutorial here, it should answer your question in detail.
really new to iPad development here. I made some mockups for what I'm trying to do.
I have a layout like so with options and menu at the bottom. When I rotate to landscape I want to get something like this:
In landscape the menu bar will always be on the right. In portrait always at the bottom. The contents of the square keep their position and rotation regardless of the device orientation.
What would be the rest way of going about this? I have considered removing all the views as the device begins to rotate and then replacing them using new coordinates. Doesn't seem like the animation will be smooth though. I understand how to do constraints, but I want the top square to stick to the tom when portrait and stick to the left when landscape, not always at the top. Any pointers on this would be really appreciated! thank you
This is a job for size classes. They let you define separate layouts for different orientations and would be an ideal solution for your problem. However, for some reason, the difference between iPad portrait and landscape orientation is not directly supported by the the current implementation of size classes.
There is a workaround, Sizing class for iPad portrait and Landscape Modes, that can redefine the meaning of the existing size classes to fit your problem. In other words, you can use the portrait and landscape size classes for the iPhone and re-map them so that they apply to the iPad.
They are selected by a 3x3 grid in Xcode’s Interface Builder. If you play with it a little, it’s easy to grasp the concept.
Here is a screen capture of the control in Interface Builder that lets you switch among your different layouts:
I have a layout issue. I'm trying to make a legacy 3.5in app work on iPhone 5. As soon as I give it the Default-568h#2x.png splash image, the whole app gets aligned to the top of the screen, leaving a huge white gap at the bottom. The autosizing struts and such seem to be set properly (not using Autolayout at the moment), but the thing doesn't stretch to fill the screen. I'm not sure where to look next. I just want my poor tab bar to be at the bottom!
Since you're not using AutoLayout, now is a great time to start. Xcode 5 makes setting constraints a simple exercise.
I suspect that your tab bar frame is hard-coded to certain x, y, width, height coordinates which work well on the 3.5" screen. You can also see how your view renders on taller screens by pressing this button in the Xcode 5 Interface Builder:
I'm trying to optimize the screen space for my graphics app and I want to support all orientations, but it would be great if I could leave the UIToolbar at the physical top of the iPhone or iPad (by the camera), and have the rest of the app and views properly deal with orientation. I will rotate the icons on the toolbar when I get a orientation event, but I want the toolbar and only the toolbar to stay put.
I want to use constraints, but can't figure out how to do this.
Anyone?
Thanks!
Constrains won't work to do this, because they would constrain the toolbar to the top of its superview, not the device, so if that superview rotates, so does your toolbar. I think you might have to do this by having a non-rotating view controller that contains your toolbar, and then just rotate a subview that contains your graphics.