【发布时间】:2013-10-08 21:15:43
【问题描述】:
我正在尝试弄清楚如何使用 Autolayout,但我发现了一个问题。我想在 IB 中创建一个大小为 200x200 的视图。这个视图,称为 PieView,有两个 UIImageViews,它们都有帧(0、0、200、200)。 我的问题是,如何在代码(我喜欢视觉格式语言)或 IB 中覆盖 updateConstraints,如果我更改 PieView 的大小(例如更改为 100),子视图也会更改(0、0、100、100 )。
以及如何更改 PieView 的大小,我正在尝试宽度和高度
NSLayoutConstraint *width = [NSLayoutConstraint constraintWithItem:self
attribute:NSLayoutAttributeWidth
relatedBy:NSLayoutRelationEqual
toItem:nil
attribute:NSLayoutAttributeNotAnAttribute
multiplier:1.0f
constant:100.f];//kDiameter * sizeCoef];
【问题讨论】:
-
200x200 PieView 有两个带帧的图像视图(0,0,200,200)?所以图像视图是堆叠在一起的?
标签: ios objective-c interface-builder ios7 autolayout