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
  • 44,280
  • 53
  • 219
  • 394

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
  • 358,182
  • 62
  • 756
  • 811