ios - Lag using runAction with a SKLabelNode on swift -


i having lag issue function used lot of times in app...

plusone(scorelabel.position,plus: 1) 

and:

 func plusone(position: cgpoint, plus : int) {          mylabel.setscale(1)         mylabel.text = "+"+string(plus)         mylabel.position = position         mylabel.hidden = false          let action1 = skaction.scaleto(2, duration: 0.5)         let action2 = skaction.fadeoutwithduration(0.5)         let actiongroup = skaction.group([action1,action2])          mylabel.runaction(actiongroup,completion: {             self.mylabel.hidden = true         })       } 

the first time use plusone function, make app freezed little time...

i not know if have been doing things well... mylabel has been declared global same... lag on first execution.

you need set font of label fix font @ start.

like that:

let yourfont = uifont(name: "yourfontname", size: 17)  var mylabel = sklabelnode(fontnamed: yourfont?.fontname) 

otherwise, font gets loaded @ first usage , not on app-start.


Comments

Popular posts from this blog

asp.net mvc - SSO between MVCForum and Umbraco7 -

Python Tkinter keyboard using bind -

ubuntu - Selenium Node Not Connecting to Hub, Not Opening Port -