Я пытаюсь вытереть ярлык, когда он появляется на экране. В настоящее время я просто скрываю его, используя(Swift) Fade-In и Out a Label
button.hidden = true
и показывать его с помощью ложных данных. Я хотел бы оживить этот процесс с постепенным исчезновением, поскольку он выглядит намного более гладко. Цените помощь!
Вот код, который я использую, который получает сообщение об ошибке. http://imgur.com/a/HI4eg
class ViewController: UIViewController {
@IBOutlet weak var yeah: UILabel!
override func viewDidLoad() {
super.viewDidLoad()
UIView.animateWithDuration(1.0, delay: 0.0, options: .CurveEaseOut, animations: {
self.yeah.alpha = 0.0
}, completion: {
(finished: Bool) -> Void in
//Once the label is completely invisible, set the text and fade it back in
self.yeah.text = "your Text "
// Fade in
UIView.animateWithDuration(1.0, delay: 0.0, options: .CurveEaseIn, animations: {
self.yeah.alpha = 1.0
}, completion: {
(finished: Bool) -> Void in
//Once the label is completely invisible, set the text and fade it back in
self.yeah.text = "your Text "
// Fade in
UIView.animateWithDuration(1.0, delay: 0.0, options: .CurveEaseIn, animations: {
self.yeah.alpha = 1.0
}, completion:nil)
})
// Do any additional setup after loading the view, typically from a nib.
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated.
}
} }
Вы ищете шкурку с гаснуть и показать с замиранием в результате? Поскольку по умолчанию скрытие не является анимированным? – Shripada