0

Yesterday, I have a problem with CGRectMake, which I already posted here: CGRectMake is not working with UIView

It is caused by having Auto Layout enabled in my project, so I have disabled it. Case closed...but today, when I run my project on the 3.5 inch simulator I have a new problem - all of my textfield, buttons, etc. seems like a mess.

Everything has no proper space between them, unlike when I had Auto Layout enabled. Here's what it looks like:

enter image description here

Is this the consequences of not enabling Auto Layout? If so, what should I do to make constant space between textfield, space of label to navbar, etc?

Community
  • 1
  • 1
Saint Robson
  • 5,475
  • 18
  • 71
  • 118
  • 2
    Duplicate. http://stackoverflow.com/questions/10872090/pros-and-cons-of-using-storyboards – lvp Sep 18 '13 at 12:46
  • 1
    Without autolayout, to get the spacing you want, you just drag stuff to where you want it (or adjust the `x` and `y` values in the "Size inspector" in IB or via code). – Rob Sep 18 '13 at 12:49
  • 2
    @lvp: Your "possible duplicate" is about **Storyboard**, not about **Auto Layout.** That are two completely independent topics. – Martin R Sep 18 '13 at 12:52
  • @MartinR : thanks for make this topic clear, bro... you're right. – Saint Robson Sep 18 '13 at 12:55

1 Answers1

3

There is nothing i haven't been able to accomplish using autolayout. In my opinion if you don't use it you will go crazy.

I think the root of your problem is that in the question that suggested you disable autolayout it could have been fixed another way: Add any view manipulating code (resizing, etc) in viewDidLayoutSubviews in your view controller.

William Falcon
  • 9,813
  • 14
  • 67
  • 110
  • 3
    Like I said in my answer. There were two options. Disable AutoLayout or learn how to do what you want WITH autoLayout. The "real" solution is to do it WITH AutoLayout. – Fogmeister Sep 18 '13 at 12:50
  • 2
    Fogmeister +1 for catching this earlier – William Falcon Sep 18 '13 at 12:53
  • @Fogmeister : thanks for reminding me about your second option, bro. disabling AutoLayout was the easiest way. but today, it caused another problem. So, I checked your answer yesterday and you said 'You have to change the constraints around them.' it gives me clue what I want to learn more. thank you... – Saint Robson Sep 18 '13 at 13:07
  • 2
    @RobertHanson yeah, store the constraints in an IBOutlet property then you can update them when you want them to move. – Fogmeister Sep 18 '13 at 13:20