How to Horizontally Center View in Landscape orientation? - ios

I have an app that was originally written for iPhone 4s landscape mode (480x320) but when I run this in iPhone 5 simulator I see that my app is aligned to the left and there's alot of blank space to the right of it. (vertically, it looks/stretches properly)
I was hoping my app would atleast be centered in landscape mode in iPhone5, any ideas?
Also, I have another app that is in portrait mode (320x480) and in iPhone 5 is does vertically center my app properly. So is this just a problem with landscape?

Found it in Size Inspector -> "AutoResizing".
Just had to align the red box correctly

Related

Landscape left preview for iPhone X in Interface Builder in Xcode 9

In Xcode/Interface Builder we have convenient buttons to show our layout with different specific devices like iPhone X, iPhone 8 and so on, and also portrait and landscape. However the only landscape mode available is landscape right. Is there anyway to have IB show our layout in landscape left, so that the notch shows up to the right?

Launchscreen rotation not working on iPhone 6s and smaller screens

I have a launchscreen storyboard with an ImageView and two labels all with some constraints to align the objects relative to the size of the screen.
When i choose a device with a screensize of an iPhone 6s or smaller in the simulator and rotate the device in landscape mode the view is not rotated.
When selecting an device with a larger screensize, e.g. an iPhone 6S Plus, the launchscreen is rotated correctly in landscape mode. Also when running it on an iPhone 6 the launchscreen is not rotated.
Any suggestions how to resolve this?
Maybe got a little bit closer to the cause. When rotating an iPhone 6 Plus or larger to the left in the Simulator, the dock icons are rotated. These are not rotated when rotating a device with a screen size equal or smaller than the iPhone 6.
I do not believe it is possible to rotate the LaunchScreen.
On the Apple Developer site: https://developer.apple.com/library/ios/documentation/UIKit/Reference/UIViewController_Class/ in the section on "Handling View Rotations" there was this line:
At launch time, apps should always set up their interface in a portrait orientation. After the application:didFinishLaunchingWithOptions: method returns, the app uses the view controller rotation mechanism described above to rotate the views to the appropriate orientation prior to showing the window.
So it looks like your main storyboard will get invoked before orientation can be taken into account.

Splash screen requirement iOS app - Portrait

I am developing an iPhone app in Xcode 7 which will only open in portrait mode. My question is do I need to provide the launch/splash/default screen also for landscape mode or providing it in the various portrait mode sizes will be sufficient?
I think adding only the portrait ones should work for you. Hope you are using xcassets for managing splash screens. There, You can select the orientations and devices which you want to support. Here is a screenshot.
NOTE: This is from Xcode 6.4. Hope it's something similar in Xcode 7.
Design the LaunchScreen.xib file to look as your desired splash screen. Set proper constraints to your design elements/views. And thats it! It will appear as expected on any orientation.
For example:
If you want your app logo to appear in the center on app launch as splash screen, set your logo in a image view at center, give constraints for horizontally centering, vertically centering and height and width constraints. Now run the app by keeping simulator in various orientations and your launch screen will appear same in all orientations.

iOS Replace the default Keyboard with a shorter Keyboard

How can I get the default keyboard to be shorter like the keyboard on the right?
The standard keyboard is the left, how do I get it to have the height of the one on the right?
The left keyboard is not taller than the right keyboard— they are the same height, in points. The difference is in the scale of the screen; i.e. the pixels are smaller on the right. Assuming that these are the same device, the difference is caused by one of two things:
The app on the left is not updated to support the higher resolution screens of the iPhone 6 and 6+. To remedy this, you can either specify a .xib as your "Launch Screen File" in the target's General settings, or add a launch image for iPhone 6 and 6+ to your asset catalog.
The app on the left is running on a device which is in "Zoomed" view mode. To change this, follow this path in your Settings app: General > Display & Brightness > View.
Edit: A good tip for recognizing such resolution differences (on an iPhone 6 or 6+) is to watch the clock as an app launches. If it gets bigger, then your device is set to the "Standard" view mode, and the application has not been updated to support iPhone 6/6+ resolutions. If the clock stays the same size, then either the app has been updated to support iPhone 6, or the device is in the "Zoomed" view mode (or both).
You cannot control the height of the keyboard. The keyboard on the left is looks taller because this app hasn't been updated for iPhone 6/6+ screens, so the keyboard and everything else in the app has been stretched.
See this question for how to support the new 6 screen sizes.

iPad screen doesn't support autolayout

I have created view using autolayout it works fine in all iPhone devices but it left some blank space at left, right, top and bottom on iPad.I tried to make another xib specially for iPad which is 768*1024 but still facing same problem.
here is the screenshot of iPad output.
The problem is that you forgot to make this a universal app. So it is running on the iPad in emulation mode as an iPhone app in a reduced frame.

Resources