【发布时间】:2018-08-13 20:51:18
【问题描述】:
我有 4 个单独的视图,我想在按下其中一个按钮时隐藏另外 3 个。
我将它们放在 UIStackView 中,但 .isHidden = true 出于某种原因没有隐藏视图。
当它们不在堆栈视图中时,它可以正常工作。
@IBAction func qbpressed(_ sender: Any) {
QBContainer.isHidden = false
WRContainer.isHidden = true
RBContainer.isHidden = true
QBIndicator.isHidden = false
WRIndicator.isHidden = true
RBIndicator.isHidden = true
TEIndicator.isHidden = true
QBButton.setTitleColor(#colorLiteral(red: 0, green: 0.5008062124, blue: 1, alpha: 1), for: .normal)
WRButton.setTitleColor(#colorLiteral(red: 0.7540688515, green: 0.7540867925, blue: 0.7540771365, alpha: 1), for: .normal)
RBButton.setTitleColor(#colorLiteral(red: 0.7540688515, green: 0.7540867925, blue: 0.7540771365, alpha: 1), for: .normal)
TEButton.setTitleColor(#colorLiteral(red: 0.7540688515, green: 0.7540867925, blue: 0.7540771365, alpha: 1), for: .normal)
if intersitial.isReady{
intersitial.present(fromRootViewController: self)
}
}
【问题讨论】:
-
isHidden 应该可以工作。您可能需要显示发布您的代码
-
刚刚发布,isHidden 在视图不在堆栈视图中时有效,但在我将它们放入堆栈视图时无效
-
属性(
QBContainer、WRContainer等)未连接到这些视图,或者某些东西将isHidden属性设置回true。使用调试器找出哪个。