0

I'm using iOS 6 auto layout. I have the portrait mode created with Interface Builder. I have a UIScrollView inside the UIView (Controller class view). I set two labels: one is right aligned to the scrollview and the other right aligned to the view. The scrollview is shorter than the view. When I simulate and rotate on landscape the label from the scroll view doesn't right align, but the label from the view is set correctly.

When you click on the scroll view label and go to Utilities > Size inspector you will see that the label has as constraint: Trailing space to: Superview. You cannot change to the ScrollView.

I also tried this in code:

[NSLayoutConstraint constraintWithItem:fileSize
                    attribute:NSLayoutAttributeRight
                    relatedBy:NSLayoutRelationEqual
                    toItem:motherScrollView
                    attribute:NSLayoutAttributeCenterX
                    multiplier:1.0
                    constant:20];

1 Answers1

0

Select the UIScrollView and then use the editor menu in Xcode to change other constraints. The superview of your scrollview will be the UIView if it's a subview of the UIView.

Mark McCorkle
  • 9,349
  • 2
  • 32
  • 42