ios - What is the animation duration of UIPageViewController's setViewControllers method -


i wondering how 1 animation duration of method:

setviewcontrollers(_ viewcontrollers: [uiviewcontroller]?,                direction: uipageviewcontrollernavigationdirection,                 animated: bool,               completion: ((bool) -> void)? = nil) 

when animated parameter set true.

i believe following code should work. please let me know if there other way

method 1:

let initialtime:cfabsolutetime = cfabsolutetimegetcurrent()  let pager:uipageviewcontroller = uipageviewcontroller() pager.setviewcontrollers(nil, direction: uipageviewcontrollernavigationdirection.forward, animated: true, completion: {(success) -> void in    let animationtime: cftimeinterval = cfabsolutetimegetcurrent() - initialtime    print(animationtime) }) 

method 2:

let pager:uipageviewcontroller = uipageviewcontroller()    pager.setviewcontrollers(nil, direction: uipageviewcontrollernavigationdirection.forward, animated: true, completion: {(success) -> void in    if let transiton = pager.transitioncoordinator {       print(transiton.transitionduration)    } }) 

edit:

as rickster mentions in comment , according official documentation, method 2 preferred method built in api gives accurate time animation finish if animations proceeds without userinteraction.


Comments

Popular posts from this blog

aws api gateway - SerializationException in posting new Records via Dynamodb Proxy Service in API -

asp.net - Problems sending emails from forum -