ios - Animation fadein/fadeout title button doesn't work -


i'm trying write function animate uibutton doing following points in order:

  • change button text
  • change button text color
  • animate button text continuous fadein/fadeout effect

so write this:

static func pulsetitlelabel(button: uibutton, text: string, color: uicolor) {     button.settitle(text, forstate: [.normal, .highlighted])     button.settitlecolor(color, forstate: [.normal, .highlighted])      uiview.animatewithduration(1.0, delay: 0.0, options: [.repeat, .autoreverse], animations: { () -> void in         button.titlelabel?.alpha = 0.0     }, completion: nil) } 

but can't see animation.

the title button becomes text , color want animation doesn't start: i'm missing something? there's better , elegant way same points?

i tried code didn't work me because used system button. changed type of button custom , works (i see pulse animation if it's expected). can verify type of button custom?

in general, approach enough. if you'd research more complex animations (not buttons), take @ facebook pop animations https://github.com/facebook/pop (some examples https://github.com/hossamghareeb/facebook-pop-tutorial)


Comments

Popular posts from this blog

sublimetext3 - what keyboard shortcut is to comment/uncomment for this script tag in sublime -

java - No use of nillable="0" in SOAP Webservice -

ubuntu - Laravel 5.2 quickstart guide gives Not Found Error -