user2543991
user2543991

Reputation: 625

Autolayout conflicts autorotation

I add a view in storyboard using autolayout. I set the constraints on the view so there is no problem for the view with autorotation.

Now, I add a subview to the view programmingly instead of using stroyboard. The autorotation doesn't work now. The subview always show as portrait, the same thing as you don't set constraints on a view in storyboard. I set the autoresizingMask = ~UIViewAutoresizingNone; but it doesn't work since this is for old style of sprint and struct.

Is there an easy way to do to make autorotation work for a view programmingly adds to a view which is using storyboard? Thanks.

Upvotes: 0

Views: 122

Answers (1)

Cy-4AH
Cy-4AH

Reputation: 4586

  1. Set translatesAutoresizingMaskIntoConstraints = NO; to your's programmaticaly created view.
  2. Programmaticaly add constraints for it.

Upvotes: 1

Related Questions