ios - How to animate preferredContentSize when using UIPopoverPresentationController? -


i able change frame of popover present setting preferredcontentsize. animate change in content size haven't been successful. instantly updates, in fact delay have set isn't respected. how 1 animate change in content size?

//in viewdidappear: uiview.animatewithduration(5, delay: 3, usingspringwithdamping: 0.5, initialspringvelocity: 0.25, options: uiviewanimationoptions.curveeaseinout, animations: { () -> void in     self.preferredcontentsize = cgsizemake(320, 400) }, completion: nil) 

i able reproduce problem, figured out way make work. animation delay isn't working here, set 0 , different type of delay before doing animation. use function found here on so:

func delay(delay: double, closure:()->()) {     dispatch_after(         dispatch_time(             dispatch_time_now,             int64(delay * double(nsec_per_sec))         ),         dispatch_get_main_queue(), closure) } 

just put @ top of swift file, outside of class definition.

then change code this:

delay(3, { () -> () in     uiview.animatewithduration(5, delay: 0, usingspringwithdamping: 0.5, initialspringvelocity: 0.25, options: uiviewanimationoptions.curveeaseinout, animations: { () -> void in         self.preferredcontentsize = cgsizemake(320, 400)         }, completion: nil) }) 

Comments

Popular posts from this blog

asp.net mvc - SSO between MVCForum and Umbraco7 -

Python Tkinter keyboard using bind -

ubuntu - Selenium Node Not Connecting to Hub, Not Opening Port -