1

I have an interface which uses elements from both an .xib and programmatically added views. I"m trying to rotate the views. The .xib elements stay in position if I assign left and bottom struts, but the programmatically added elements lose their position relative to the bottom of the screen.

How can I programmatically replace the top strut for a UIView with a bottom strut? I know that springs can be added with

uiview.autoresizingmask = ...;
Alex Stone
  • 46,408
  • 55
  • 231
  • 407

1 Answers1

5

The autoresizingMask property also controls "struts". It sounds like you want to do this:

UIViewAutoresizing mask = myView.autoresizingMask;
mask &= ~UIViewAutoresizingFlexibleBottomMargin;
mask |= UIViewAutoresizingFlexibleTopMargin;
myView.autoresizingMask = mask;
rob mayoff
  • 375,296
  • 67
  • 796
  • 848