在ObjectiveC中,我使用setHidden使内在大小无效
- (void)setHidden:(BOOL)hidden {
super.hidden = hidden;
[self invalidateIntrinsicContentSize];
}
然后我在某些视图上调用它,如
view.hidden = YES;
但是我找不到如何在swift上做同样的事情
答案 0 :(得分:10)
class myCustomView : UIView{
override var hidden: Bool {
get {
return super.hidden
}
set(v) {
super.hidden = v
someOtherFunction()
}
}
}
var view = myCustomView()
view.hidden = true