iOS Auto Layout - ios

I have the following view controller that I want to look great on all iPhones, I have been trying for hours and hours with the auto layout with no luck. The cats are buttons with the cat image as a background to the button. Can somebody tell me what should I do?
UPDATE: My goal is that there size adapts to the different iPhone screen sizes and they remain positioned this way. I tried setting 4 constraints from the 4 sides while not locking the width and the height and it looks bad. Help, please?
This is the image

You can use multiplier property of autolayout constraints to achieve this. Please share your xib file

Use size class for the different size screen with autolayout . It will resolve you problem.

Related

AutoLayout problem when trying to display on iPads or smaller screens

I am trying to create an app with this UI.
I am facing a lot of problems because it's like a rhombus.
I tried to use a vertical stackView and these are my previews and my constrains.
I've tried to use aspect ratio(1:1.13 because they are not squares) to resize on all o the screens but on iPad its a lot bigger.
Is there a way to make it smaller on iPads?
I am new to auto layout so I am sorry if this question is not correct.
You're probably overthinking this. Instead of a stack view, create a "spacer" view and use constraints to center it and give it the correct height and width for all screen sizes. Test it. Now add the four squares, giving them correct height and width and positioning them in relation to the "spacer" view. Test that. Finally, hide the "spacer" view.

How to make auto layout resize labels and other objects based on screen size

What constraints would make this view resize the labels 1-9 with a smaller font and label size in order to keep labels 1-9 within the view. I have tried using minimum font scale and pinning the labels to all sides of the view. Any tips and or help with auto layout and building responsive UI's in Xcode are appreciated thank you.
iPhone 7 Plus screen size simulation
iPhone 4s screen size simulation
It's easy!
You can use constraints like this:
After adding all constraints you need check UILabel configuration:
If you have question - you can ask :)
I think here, you can find answer to your question (Part: Two Equal-Width Views).
A idea lies inside of using additional view between the labels and strengthening first and last labels to a top and a bottom edge of a parent view.
All you have to do is add some NSLayoutConstraints and change some UILabel Properties in the UIStoryBoard Interface Editor .. I have added an image and a gif for reference.
This gif image will give a detailed explanation :

Split View into four Subviews with 25% width

I want to insert 4 Subviews with exact 25% percent width of the SuperView.
So, my question is how to achieve that with XCode's Autolayout? In Android I would use a GridLayout or a LinearLayout...
Thanks in advance
Just set your constraints like this image,you will get what you want
And this is preview in different screen sizes
You have to select all the four views, and add top, bottom, left, right constraints to zero and equal width constraint.
Your constraints should look like this.
In the screenshot, the four views are arranged over a container view. If you dont't want the container view, then you have to specify the height constraint also.
You should use UIStackView that is introduce in ios9 and xcode 7.0
Here is a link of the tutorial have a look its like a linear layout in android
http://code.tutsplus.com/tutorials/ios-9-getting-started-with-uistackview--cms-24193
There are alot other ways as this is the new one and it help to reduce work and time both so you should use it.Thanks

Autolayout views always same size on different screen sizes

I have a view:
Can someone help me to layout these views that they all look the same on every iPhone? I mean size is dynamic and views shrink according to screen size.
I have tried aspect ration and other layout options but none helped.
if you want to change the view sizes on different screens using auto layout ,you have to add the height and width constraints .then only it changes view size.
Steps:
open your project in xcode.
goto storyboard choose Auto layout ,select your view ,
in Xcode From the Editor menu, choose Pin\Width and Height both
http://www.raywenderlich.com/50317/beginning-auto-layout-tutorial-in-ios-7-part-1
As per your question please look at the link below it might help solving your problem of multiple views size and layout.
https://stackoverflow.com/a/27471120/4101371
you can also refer:
https://www.youtube.com/watch?v=Nl2iMF0yKW8&list=PLXCowKcXAVgrxHKLWTa4HxNPrSmTj3D-_
I've also added this link in the answer in above answer.

Layout issue, Autolayout enabled but doesn't seem to work

Below is my app when run on iPhone 6 simulator
As you might have guessed it looks good on iPhone 5.
Autoresize is on, but I'm not sure i fully grasp the concept, so i might be missing something.
Any suggestions for a solution are appreciated.
I also added another image for the storyboard structure.
It might be possible as you might have not set layout constraints. The below link will help you how to set constraints. In the below link i've used size class but it is not necessary for you to use sane view, similar constraints can be applied to the storyboard structure you have used.
Hi please visit below link:
iOS 8 Autolayout with Size Classes
Advance auto layout Constraints:
Adjust Center of Measure in Xcode 6
Auto layout is on but you are not using it. You need to add constraints so that when the main view is resized to fit the screen, the table view is resized along with it. Otherwise, it just stays at the same size you designed it (which happens to be the right size for an iPhone 5). These devices are different sizes; the idea of auto layout is to cope with that difference. Use it.

Resources