且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

iOS 等效于 Android View.GONE 可见性模式

更新时间:2023-11-06 14:51:58

添加一个将视图高度设置为 0 的约束(NSLayoutAttributeHeight)对我有用:

Adding a constraint(NSLayoutAttributeHeight) that sets height of the view to 0 worked for me:

[self.view addConstraint:[NSLayoutConstraint constraintWithItem:self.captchaView attribute:NSLayoutAttributeHeight relatedBy:NSLayoutRelationEqual toItem:nil attribute:NSLayoutAttributeNotAnAttribute multiplier:1.0 constant:0]];