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

powershell Start-Process exit code -1073741502 when used with Credential from a windows service environment -

twig - Using Twigbridge in a Laravel 5.1 Package -

c# - LINQ join Entities from HashSet's, Join vs Dictionary vs HashSet performance -