david
david

Reputation: 666

Confuse in choosing autolayout in storyboard?

I am under one project.In that I am using some image files and some button. When i use to place button in my viewcontroller and see that preview using assistants editor. My button are mis placed in different places.so i thought to use autolayout.But small confuse in that. I am beginner to ios.I have some question?

METHOD 1

When I uncheck this autolayout option like image (A)shown below.its working perfect in all iphone simulator(3.5, 4, 4.5, 5.5). By setting autolayout using below option (B)

[A] enter image description here

[B] enter image description here

METHOD 2

At the same time when i put check mark autolayout option and use like this image show below.I am getting some misplace (Not in arrangement].I know I miss some constraints.But its not better than my above question

enter image description here

please give me some suggestion about this.Which one should I use? METHOD 1 (OR) METHOD 2. I am new to ios .kindly suggest me something about this?

Upvotes: 1

Views: 85

Answers (2)

Sabrican Ozan
Sabrican Ozan

Reputation: 738

You may check here for differences between autolayout(Method 1) and autoresizing mask(Method 2). Apple suggests devs to have their view layouting using Autolayout so there is not actually a question in here.

You probably messed up with constraints as every beginner does so I would recommend you to take a time in here and try to finish this tutorial.

Upvotes: 1

luk2302
luk2302

Reputation: 57114

Method 2! Autolayout. It is very powerful and (if you get the hang of it) quite easy and intuitive to use. You can create pretty much arbitrarily complex user interfaces using it. It has its limits, but in most of the cases you don't encounter them and most of the times they are fixable using constraints set up via code instead of the interface builder if needed.

Method 1 was fine while it was the only option and may still be okay for simple layouts. But as soon as you want to have a little bit more complex relations between different UI elements, like one UILabel being half the size of a UIImage, you will run against a wall.

Upvotes: 2

Related Questions