【发布时间】:2015-12-19 22:10:45
【问题描述】:
我的 ViewWillAppear 方法中有这段代码,它只是将一组标签移出屏幕:
override func viewWillAppear(animated: Bool) {
super.viewWillAppear(animated)
//Hide 1,3,5 RM labels
oneRepMax.center.y += view.bounds.height
threeRepMax.center.y += view.bounds.height
fiveRepMax.center.y += view.bounds.height
}
所有 3 个标签都已正确链接到我的故事板文件。当我运行该项目时,什么也没有发生。
如果我将完全相同的代码复制到链接到按钮的方法中,它会按预期工作。
项目中没有其他任何东西,所以我很困惑为什么这不起作用。
我正在使用 Xcode 7 并遵循在 ViewWillAppearMethod 中工作的教程。 如下:
override func viewWillAppear(animated: Bool) {
super.viewWillAppear(animated)
heading.center.x -= view.bounds.width
username.center.x -= view.bounds.width
password.center.x -= view.bounds.width
loginButton.center.y += 30
loginButton.alpha = 0
}
【问题讨论】: