【发布时间】:2015-04-10 23:24:41
【问题描述】:
我正在使用此代码来更改分段控件的高度。它适用于 8.0 和最新版本,但不适用于 7.1 等更低版本。你知道有什么其他方法可以改变它吗?谢谢!
NSLayoutConstraint *constraint = [NSLayoutConstraint constraintWithItem:segmentedControlShortcuts
attribute:NSLayoutAttributeHeight
relatedBy:NSLayoutRelationEqual
toItem:nil
attribute:NSLayoutAttributeNotAnAttribute
multiplier:1
constant:50];
这是我在 7.1 中收到的错误:
"2015-04-09 12:10:06.626 KMetrix[546:607] 无法同时满足约束。 以下列表中的至少一个约束可能是您不想要的。试试这个:(1)查看每个约束并尝试找出您不期望的; (2) 找到添加了一个或多个不需要的约束的代码并修复它。 (注意:如果您看到不理解的 NSAutoresizingMaskLayoutConstraints,请参阅 UIView 属性 translatesAutoresizingMaskIntoConstraints 的文档) ( "", “” )
将尝试通过打破约束来恢复
中断 objc_exception_throw 以在调试器中捕获它。 中列出的 UIView 上的 UIConstraintBasedLayoutDebugging 类别中的方法也可能会有所帮助。”
【问题讨论】:
标签: ios objective-c xcode uisegmentedcontrol