ios - Swift cant resolve CurveEaseIn in UIView.animateWithDuration when using parameter from function inside animation block -


i trying pass parameter function change layout constraint in animation block dynamically.

this works:

func movekeyboard (up: bool, newmargin: int) {      uiview.animatewithduration(0.2, delay: 0, options: .curveeasein, animations: {          self.topmarginconstraint.constant=10;          }, completion: { finished in             println("animation end!")     })  } 

and doesn't (i error "could not find member curveeasein"):

 func movekeyboard (up: bool, newmargin: int) {      uiview.animatewithduration(0.2, delay: 0, options: .curveeasein, animations: {          self.topmarginconstraint.constant=newmargin;          }, completion: { finished in             println("animation end!")     })   } 

how should define function able use newmargin parameter inside animation block?

it's because, "constant" of type "cgfloat" , passsing "int":

func movekeyboard (up: bool, newmargin: cgfloat)     {          uiview.animatewithduration(0.2, delay: 0, options: uiviewanimationoptions.curveeasein, animations: {              self.topmarginconstraint.constant = newmargin;              }, completion: { finished in                 println("animation end!")         })      } 

check out it's working fine.


Comments

Popular posts from this blog

timeout - Handshake_timeout on RabbitMQ using python and pika from remote vm -

gcc - MinGW's ld cannot perform PE operations on non PE output file -

c# - Search and Add Comment with OpenXML for Word -