通过打破约束,布局按钮来恢复VFl。标签

时间:2015-06-01 02:39:53

标签: ios autolayout

我试图使用VFL移动标签,这是按钮的子视图,如下所示:

[dic_bind_views setObject:btn.titleLabel forKey:[NSString stringWithFormat:@"%@",@"title"]];
[btn.titleLabel setTranslatesAutoresizingMaskIntoConstraints:NO];
NSString *format_container_title = [NSString stringWithFormat:@"V:|-[title]-(%d)-|", ITEM_TITLE_OFFSET];
[btn addConstraints:[NSLayoutConstraint constraintsWithVisualFormat:format_container_title  options: 0                                                                     metrics:nil views:dic_bind_views]];

代码如下:

(Note: If you're seeing NSAutoresizingMaskLayoutConstraints that you don't understand, refer to the documentation for the UIView
property translatesAutoresizingMaskIntoConstraints) 
(
    "<NSLayoutConstraint:0x7ff79b63c8e0 UIButtonLabel:0x7ff79b632860'\U97f3\U6548'.top ==
UIButton:0x7ff79b4bc220'\U97f3\U6548'.topMargin>",
    "<NSLayoutConstraint:0x7ff79b63c930 V:[UIButtonLabel:0x7ff79b632860'\U97f3\U6548']-(-40)-|   (Names:
'|':UIButton:0x7ff79b4bc220'\U97f3\U6548' )>",
    "<NSLayoutConstraint:0x7ff79b535470 UIButtonLabel:0x7ff79b632860'\U97f3\U6548'.height <=
UIButton:0x7ff79b4bc220'\U97f3\U6548'.height>"
)

Will attempt to recover by breaking constraint 


NSLayoutConstraint:0x7ff79b63c8e0 UIButtonLabel:0x7ff79b632860'music'.top ==
UIButton:0x7ff79b4bc220'music'.topMargin

布局显示了我的意图,没有警告,但我在控制台中得到了这样的结果:

$('form').sisyphus({
    locationBased: false,
    timeout: 10,
    autoRelease: false
});

有人对此有任何线索吗?我希望在将来更新API时,这不会产生像应用程序崩溃这样的副作用..非常感谢。

0 个答案:

没有答案