删除特定对象的自动布局约束 [英] Remove Auto-Layout Constraints for Specific Object

查看:18
本文介绍了删除特定对象的自动布局约束的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在 UIView 中嵌入了一个 UIImageView.我的整个应用程序使用 AutoLayout,但我想删除 UIImageViewconstraints.Xcode 不允许我删除 constraints,有没有办法为特定对象禁用它们,将它们设置为零,什么?

I have a UIImageView embedded in a UIView. My entire app uses AutoLayout, but I want to remove constraints for the UIImageView. Xcode will not allow me to delete the constraints, is there a way to disable them for a specific object, set them to zero, something?

推荐答案

我同意 Xcode 自动布局在你想要一些特别的东西时使用起来很糟糕......

I agree Xcode auto-layout is horrible to use if you want something particular...

我用来以编程方式删除约束的内容:

What I use to remove constraints programatically:

[detailsPhotoView removeConstraints:detailsPhotoView.constraints];

这篇关于删除特定对象的自动布局约束的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆