【发布时间】:2013-06-13 10:36:36
【问题描述】:
我正在使用 iOS 6 自动布局。
我有使用 Interface Builder 创建的肖像模式。
我在UIView(控制器类视图)中有一个UIScrollView。我设置了两个标签:一个与滚动视图右对齐,另一个与视图右对齐。滚动视图比视图短。当我在横向上模拟和旋转时,滚动视图中的标签没有右对齐,但视图中的标签设置正确。
当您单击滚动视图标签并转到Utilities > Size 检查器时,您将看到标签具有约束:Trailing space to: Superview。您不能更改为 ScrollView。
我也在代码中试过这个:
[NSLayoutConstraint constraintWithItem:fileSize
attribute:NSLayoutAttributeRight
relatedBy:NSLayoutRelationEqual
toItem:motherScrollView
attribute:NSLayoutAttributeCenterX
multiplier:1.0
constant:20];
【问题讨论】:
标签: iphone xcode scrollview autolayout right-align