iOS7 issues with NSIBPrototypingLayoutConstraint autolayout constraints generated by Interface Builder

被刻印的时光 ゝ 提交于 2019-12-05 02:06:06

I had to manually remove constraints on the views in addition to using translatesAutoresizingMaskIntoConstraints.

[_viewContainer removeConstraints:_viewContainer.constraints];
[self.view removeConstraints:self.view.constraints];

After adding these changes, there were no more errors with animating.

In order to remove the NSIBPrototypingLayoutConstraint generated by IB, it can be solved by adding some dummy constraints on the IB, and set them remove at build time. Then, IB won't generate the NSIBPrototypingLayoutConstraint for you.

Obligatory Swift:

view.removeConstraints(view.constraints)

Alternatively, if you want to remove constraints for one particular interface item in code, you can remove them for just one object. Here are a few examples:

myTableView.removeConstraints(myTableView.constraints)
myButton.removeConstraints(myButton.constraints)
myImageView.removeConstraints(myImageView.constraints)

This can be particularly useful if you are, for example, creating a paid or free version of an app. You can do most of the interface layout in interface builder and then make tweaks to the layout in code using Visual Format Language.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!