我有大约 20 个 UILabel 想立即隐藏。我知道可以为每个标签设置一个 IB Outlet 然后调用 labelOne.hidden = YES;对于每个 UILabel,但我认为必须有更好的方法。
我尝试将每个 UILabel 设置为一个 IB Outlet Collection,但您不能在 Outlet Collection 上调用 hidden。有什么建议么?
最佳答案
几个选项:
hidden
:[self.labelsCollection setValue:@true forKey:@"hidden"];
请注意,这是
@true
/@false
,而不是 true
/false
. for (UILabel *label in self.labelsCollection) {
label.hidden = true;
}
UIView
的这些 subview 然后隐藏该父 View 。 关于ios - 一次隐藏多个 UILabel,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40754860/