Unable to simultaneously satisfy constraints.


转:http://blog.163.com/l1_jun/blog/static/14386388201432224129306/

 

一个按钮在storyboard中没有设置约束,但会默认生成约束,在代码要想改变它的frame,那就得设置translatesAutoresizingMaskIntoConstraints=YES,但有时会出现“Unable to simultaneously satisfy constraints.”之类的错误。解决办法:

What turned out to be the easiest thing for me was to remove the view I wanted to move/resize from its superview, set its frame, and then add it back. For example, take a custom UILabel in a UITableViewCell subclass:

[cell.myLabel removeFromSuperview];
cell.myLabel.frame = someFrameIGenerated;
[cell.contentView addSubview:cell.myLabel];
原文链接: http://stackoverflow.com/questions/13186908/can-i-use-setframe-and-autolayout-on-the-same-view

你可能感兴趣的:(Unable to simultaneously satisfy constraints.)