My objective is to get label0
to dynamically change text as label1
changes transparency.
Here is a section of the code i used for label1
's animation:
UIView.animateWithDuration(2.0, animations: { () -> Void in
self.label1.alpha = 0.0
//this is what happens after "tIme"
dispatch_after(tIme1, dispatch_get_main_queue()) {
UIView.animateWithDuration(2.0, animations: { () -> Void in
self.label1.alpha = 1.0
})
dispatch_after(tIme20, dispatch_get_main_queue()) {
UIView.animateWithDuration(5.0, animations: { () -> Void in
self.label1.alpha = 0.0
})
}
}
})
It basically it starts from being transparent, after 1s it fades into completely visible, and after 20s it goes back to being transparent. THIS PART OF CODE WORKS ^
The part that doesn't work is the one that is supposed to make label0
change:
if(label1.alpha == 0.0) {
self.label0.text = "transparent"
}
else {
self.label0.text = "visible"
}
What i'd like this to be doing is pretty self explanatory. If label1
is transparent make label0
say "transparent" or else say "visible". The problem is that it keeps saying "transparent" even when label1
is visible.
How do i fix this?
If you need any clarification, don't hesitate to ask.
EDIT: Its not possible for me to change the animation, because what i need to do is display some text on ViewDidLoad, and other text on ViewDidAppear. I could to that easily, but since its different text, the first time i open the app it would overlap. So what i need to do is wait for the first text to disappear, and then check if its invisible. If it is, on ViewDidAppear, i can display my second text.