reza_khalafi
reza_khalafi

Reputation: 6552

How to make little shake after change page in UIPageViewController iOS Swift 3

How to make little shake after change page in UIPageViewController?
I have UIPageViewController and works correctly but i want make animate in end of changing page with Swip right and left.

self.setViewControllers(
  [getViewControllerAtIndex(idx)],
  direction: .forward,
  animated: true, completion: nil    
)  

For realizing my intention check out Laundrapp app in App Store.
Thank you.

Upvotes: 0

Views: 241

Answers (1)

oiledCode
oiledCode

Reputation: 8649

You should use theUIPageViewControllerDelegate, in particular the following method :

pageViewController(_:didFinishAnimating:
                     previousViewControllers:
                     transitionCompleted:)

Basically this method will tell you when the page controller has finished the changing page animation, once it has finished you can animate your view with the animation you like. You can also detect if the user has just scrolled a bit without changing page, inside the transitionCompleted handler.

Upvotes: 1

Related Questions