ios - How to disable standard UIButton touch event -


in application added uibutton, instead of having standard touch event of uibutton getting darker becoming standard color when touch events have ended, want add animation when click on uibutton button gets smaller, when touch events have ended uibutton becomes regular size when touch events have ended. far have typed code, not seem work. please let me know how can accomplish animation.

// whatsthegame uibutton have  @ibaction func whatsthegame(_ sender: uibutton) {      logo.ishighlighted = false      uiview.animate(withduration: 0.3) {          if let centerlogo = self.logo {              centerlogo.transform = cgaffinetransform(scalex: 0.7, y: 0.7)         }     } }  override func touchescancelled(_ touches: set<uitouch>, event: uievent?) {     super.touchescancelled(touches, with: event)      uiview.animate(withduration: 0.3) {          if let centerlogo = self.logo {              centerlogo.transform = cgaffinetransform(scalex: 1, y: 1)         }     } }  override func touchesended(_ touches: set<uitouch>, event: uievent?) {     super.touchesended(touches, with: event)      uiview.animate(withduration: 0.3) {          if let centerlogo = self.logo {              centerlogo.transform = cgaffinetransform(scalex: 1, y: 1)         }     } } 

adding touch inside , touch down events

@ibaction func ontouchupinside(_ sender: any) {      let button = sender as! uibutton      uiview.animate(withduration: 0.3) {          button.transform = cgaffinetransform(scalex: 1, y: 1)     } }  @ibaction func ontouchdown(_ sender: any) {      let button = sender as! uibutton      uiview.animate(withduration: 0.3) {          button.transform = cgaffinetransform(scalex: 0.7, y: 0.7)     } } 

Comments

Popular posts from this blog

node.js - Node js - Trying to send POST request, but it is not loading javascript content -

javascript - Replicate keyboard event with html button -

javascript - Web audio api 5.1 surround example not working in firefox -