首先呢在SB中有一个Label。
动画代码如下:
override func viewWillAppear(animated: Bool) {
super.viewWillAppear(animated)
label.center.y += self.view.bounds.height
}
override func viewDidAppear(animated: Bool) {
super.viewDidAppear(animated)
label.center.y -= self.view.bounds.height
}
在模拟器中运行以后,发现在动画之前这个label就已经出现在了界面上。
所以整个效果是先出现了,然后从屏幕中消失,然后又出现。
但是我希望的是在一开始的时候他并没有出现。
关闭AutoLayout
label.alpha = 0 初始化