ios - UIButton change font and text at the same time -


we have uibutton in our app change , forth between displaying normal system font string , fontawesome icon (which unicode character specific font). can switch , forth between these fine, except ios animates 2 changes 1 after other, there brief amount of time text shows strangely after first change before second. tried using uiview.beginanimations commitanimations counterpart, animatewithduration:animations:, neither had effect.

how can change both text , font @ same time?

edit: updated code per comment

func changetosend() {     sendbutton.titlelabel?.font = uifont(name: "system", size: 15)     sendbutton.settitle("send", forstate: uicontrolstate.normal) }  func changetomicrophone() {     sendbutton.titlelabel?.font = uifont(name: "fontawesome", size: 24)     sendbutton.settitle("\u{f130}", forstate: uicontrolstate.normal) } 

try this:

    func changetosend() {         uiview.performwithoutanimation {              self.sendbutton.titlelabel?.font = uifont(name: "system", size: 15)             self.sendbutton.settitle("send", forstate: uicontrolstate.normal)         }     }      func changetomicrophone() {         uiview.performwithoutanimation {             self.sendbutton.titlelabel?.font = uifont(name: "fontawesome", size: 24)             self.sendbutton.settitle("\u{f130}", forstate: uicontrolstate.normal)         }     } 

Comments

Popular posts from this blog

php - Passing multiple values in a url using checkbox -

compilation - PHP install fails on Ubuntu 14 (make: *** [sapi/cli/php] Error 1) PHP 5.6.20 -

sql - Postgresql tables exists, but getting "relation does not exist" when querying -