UIView autoresizingMask problem

10,938

If you want the view to be at lower-right corner, it should have a flexible left and top margin.

 xView.autoresizingMask = UIViewAutoresizingFlexibleLeftMargin | 
                          UIViewAutoresizingFlexibleTopMargin;
Share:
10,938

Related videos on Youtube

emenegro
Author by

emenegro

Updated on April 25, 2022

Comments

  • emenegro
    emenegro about 2 years

    In iPad. I have a UIViewController with another UIview inside it, at the bottom.

     ____________
    |            |
    |            |
    |   UIView   |
    | Controller |
    |            |
    |            |
    |         X  |
     ------------
    

    The UIView is the X.

    I define for it an autoresizingMask like this, on the viewDidLoad of the UIViewController

    self.view.autoresizeSubviews = YES;
    
    // xView creation
    
    xView.autoresizingMask = UIViewAutoresizingFlexibleRightMargin | UIViewAutoresizingFlexibleBottomMargin;
    

    But this doesn't works, the xView rotates fine but out of the screen bounds on landscape.

    What I'm missing?

  • emenegro
    emenegro almost 14 years
    Still going outside thebounds. I don't know waht I'm doing wrong. When I try this on IB and rotates the view on IB, it works. But when I run the project, go out of the bounds. I'm sure I'm missing a property or something else :(
  • kennytm
    kennytm almost 14 years
    @Espuz: What's the autoresizing masks of all superviews of xView?
  • emenegro
    emenegro almost 14 years
    Thanks, Kenny, you got me the quid of the question. In my parent xView I don't have mask. Y put your mask on xView and UIViewAutoresizingFlexibleHeight on its parents and now it works well. Thank you again ^^