IOS 8 off center - ios

I am trying to write a minimal program, IOS 8 using XCODE 6.1, I add a label and set it to centre for both horizontal and vertical. But it appears off-centre when I run it, any idea?

Related

How to ensure that buttons scale properly to different screen size in Swift for iOS

I am new to Swift and I am still struggling to find an easy way to make sure that my UI will scale properly based on screen size.
My UI is made of few buttons and labels and it was built on a iPhone 8 Plus screen. But now when I run it on smaller or bigger devices, the button are either not entirely visible or not centered.
How can I make sure that what I see on the iPhone 8 Plus is being scaled correctly to other devices? Any example I can follow?
I am using Xcode 12 and latest Swift version.

Autolayout differences between iOS 8 and iOS 9

If I run the same code on iOS 8 and iOS 9 the layout comes out differently. The icon and label should be even.
I'm using a custom font so I'd assume the font size / height is the same in both OSes. If I adjust the spacing constraint to be right on 9 it shows up wrong on 8.
Any ideas?
Update
Here is the existing constraint:

Why autolayout behaves different in iOS 7 and iOS 8?

For example: I have set in a storyboard scene a vertical space constraint from de bottom of a UIButton to the bottom of the superview with a constant of 20. When running in an iOS 8 device, this is correctly shown, but when running in an iOS 7 device, it looks like this constant becomes higher and the button is shown upper in the screen... I don't understand why this happens, since autolayout is supposed to be available since iOS 7.
Any help? I don`t know how to handle this.
Thanks in advance
One of new things in iOS 8 is the Layout Margin. Layout Margin is a new property available in UIView for iOS 8. So, any objects inherit from UIView will have this property. If you are developing the app for both iOS 7 and iOS 8, you should not use Layout Margin (or use layout margin in a smart way).
So, if you have any constraints related to layout margin and you didn’t do a proper check before launching the app on iOS 7 devices, the app might crash or the arrangement of the objects might be out of order.
Whenever you are trying to add new constraints from the storyboard in XCode 6, “Constrain to Margins” is ticked by default. The meaning of this selection is to add constraints with the new property in iOS 8.
If the deployment target of your app is iOS 7 and above and any of your constraints have this layout margin, the XCode will complain with the warning “Layout attributes relative to the layout margin on iOS prior to 8.0″.
If you are developing the app for both iOS 7 and 8, it is best to “Untick” the Constrain to Margins.
Reference: you should also check this great tutorial

UI label wont align properly in iOS 6/iOS 7

I created the applications using Xcode 5[IOS 7].I used the custom font for this applications.
While i run the application in IOS 7 the label alignment good.But when i run the same application IOS 6 the label alignment wont align properly.
iOS 7
iOS 6.
kindly give me the solutions.
You have to go with below step:
step (1)
Uncheck mark Autolayout field.
step (2)
From your nib file set value of that UILable is: "Y" = -20;
may be it will help.
This problem is pretty much weird but has a simple solution.I had been facing the same problem too.
Click on the label and then autoresize it by clicking Command key icon ⌘ (Command key) and the = (equal to) sign together.
This should autofit the label.

Interface Builder, frame changes on IOS 6

I have a xib file that support IOS 6 and 7.
The problem is when i selected view as IOS 6 the frame from IOS 7 change, and vice versa.
Here is a screenshot, previewing the IOS 6.1.
I adjust the frame to (0, -3, 255, 85) and when adjust the frame using view as IOS 7 the frame becomes:
(-345,894,0,0).
When i adjust the frame using view as IOS 6.1 and early the frame changes for IOS 7.
I just want to use the same frame in both IOS version.
Some informations that may be relevant:
Was an existing project build for IOS 5.1 and later, then i update the project to support IOS 7.
When i made the update some views (include this one) have their frame changed to positions that does not make any sense and size their size set (0,0).
First i think was an interface builder issue preview issue, but i tested on devices with IOS 6 and 7 and the results are the same from the preview
Thanks in advanced!
When you assign bottom margin & top margin in Autoresizing tab, iOS 7 gets confused & produces strange effects.
I faced the same problem, & i solved it using height stretch. Refer image.
Use 'iOS 6/7 deltas' fields to adjust design element(s) position on your controller for different iOS.
You should setup your project (setup how UI view) for one of iOS versions (6.1 or earlier/7.0 or later) and then adjust interface by deltas to other version.
You also can use new preview mode to see difference between two operation systems on one screen.
Here is link to APPLE iOS 7 transition guide - https://developer.apple.com/library/ios/documentation/UserExperience/Conceptual/TransitionGuide/SupportingEarlieriOS.html#//apple_ref/doc/uid/TP40013174-CH14-SW1
First set your view size as none and then Set your frame using view as iOS 6.1 and earlier. Now test in iOS 6 and 7. It will automatically resize your view frame.

Resources