Noah
Noah

Reputation: 101

How to preload a viewcontroller in UIPageViewController? Swipe delay

I have 3 views in my pageviewcontroller, all of them load tableviews. When I swipe from the first view to the left or right there is a small delay. After the initial swipe the delay goes away.

I have figured out that it is because the xml parsing/Json parsing slows down the viewdidload of both viewcontrollers.

How could I preload the viewcontrollers so that I get a smooth swipe with no delay in the pageviewcontroller?

Upvotes: 2

Views: 1197

Answers (1)

Li Zhao
Li Zhao

Reputation: 21

What I did for this problem was making an instance for each viewController and call controller.view.layoutSubViews() before putting them into the array of UIPageViewController. Furthermore, if your are using UITableView or UICollectionView, you need to call reloadData() when you get data from server.

Upvotes: 2

Related Questions