问题描述
我有需要将其框架编程方式操作一个观点 - 这是一种文件认为,换到它的内容,然后通过操纵框架起源滚动并围绕上海华放大。自动布局与此战斗在运行时。
I have a view that needs to have its frame manipulated programmatically - it's a kind of document view that wraps to its content which is then scrolled and zoomed around a superview by manipulating the frame origin. Autolayout fights with this at runtime.
禁用自动布局完全似乎有点苛刻,因为它可以合理地用于处理布局的其他意见。看起来我可能要的是某种空约束。
Disabling autolayout completely seems a bit harsh because it could reasonably be used to handle layout for the other views. It seems like what I might want is some kind of "null constraint".
推荐答案
我有同样的问题。但我已经解决了。
是的,你可以在运行时禁用自动布局特定的UIView
,而不是禁用它是默认的X code将整个厦门国际银行或故事板4.3更高版本。
I had the same problem. But I have resolved it.
Yes, you can disable auto layout at runtime for a specific UIView
, instead of disabling it for the whole xib or storyboard which is set by default in Xcode 4.3 and later.
设置 translatesAutoresizingMaskIntoConstraints
到是
,之前你设定子视图的框架:
Set translatesAutoresizingMaskIntoConstraints
to YES
, before you set the frame of your subview:
self.exampleView.translatesAutoresizingMaskIntoConstraints = YES;
self.exampleView.frame = CGRectMake(20, 20, 50, 50);
这篇关于我可以禁用自动布局在运行时一个特定的子视图?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!