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:

https://github.com/eugeneteh/delegateanimatetest

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

Popular posts from this blog

java - UnknownEntityTypeException: Unable to locate persister (Hibernate 5.0) -

python - ValueError: empty vocabulary; perhaps the documents only contain stop words -

ubuntu - collect2: fatal error: ld terminated with signal 9 [Killed] -