ios - UIView.animateWithDuration does not work when called from delegate? -
i using following function move self.view specified x axis:
func shiftmaincontainer(#targetposition: cgfloat, completion: ((bool) -> void)! = nil) { uiview.animatewithduration(0.5, delay: 0, usingspringwithdamping: 0.8, initialspringvelocity: 0.5, options: uiviewanimationoptions.curveeaseinout, animations: { self.view.frame.origin.x = 300 println("view should shift") }, completion: completion) }
when call function @ibaction button in same view, works, when call using delegate method sub-view, nothing happens. know delegate works because println prints text should, view isn't shifted in first scenario.
does calling subview delegate make difference?
can point me in right direction? i've been banging head on wall better part of day now.
update:-
manage reproduce problem in new blank project. check out here:
in case works fine me when added self.view.layoutifneeded()
func shiftmaincontainer(#targetposition: cgfloat, completion: ((bool) -> void)! = nil) { uiview.animatewithduration(0.5, delay: 0, usingspringwithdamping: 0.8, initialspringvelocity: 0.5, options: uiviewanimationoptions.curveeaseinout, animations: { self.view.frame.origin.x = 300 println("view should shift") self.view.layoutifneeded() }, completion: completion) }
Comments
Post a Comment