topLayoutGuide in child view controller

While this answer might be correct, I still found myself having to travel the containment tree up to find the right parent view controller and get what you describe as the “real topLayoutGuide“. This way I can manually implement automaticallyAdjustsScrollViewInsets. This is how I’m doing it: In my table view controller (a subclass of UIViewController … Read more

How to Make the scroll of a TableView inside ScrollView behave naturally

The solution to simultaneously handling the scroll view and the table view revolves around the UIScrollViewDelegate. Therefore, have your view controller conform to that protocol: class ViewController: UIViewController, UIScrollViewDelegate { I’ll represent the scroll view and table view as outlets: @IBOutlet weak var scrollView: UIScrollView! @IBOutlet weak var tableView: UITableView! We’ll also need to track … Read more

UIPageViewController: return the current visible view

You should manually keep track of the current page. The delegate method pageViewController:didFinishAnimating:previousViewControllers:transitionCompleted: will tell you when to update that variable. The last argument of the method transitionCompleted: can tell you whether a user completed a page turn transition or not. Then, you can get the currently presented View Controller by doing self.viewControllers?.first

How do I Disable the swipe gesture of UIPageViewController?

The documented way to prevent the UIPageViewController from scrolling is to not assign the dataSource property. If you assign the data source it will move into ‘gesture-based’ navigation mode which is what you’re trying to prevent. Without a data source you manually provide view controllers when you want to with setViewControllers:direction:animated:completion method and it will … Read more

Is it possible to Turn page programmatically in UIPageViewController?

Yes it is possible with the method: – (void)setViewControllers:(NSArray *)viewControllers direction:(UIPageViewControllerNavigationDirection)direction animated:(BOOL)animated completion:(void (^)(BOOL finished))completion;` That is the same method used for setting up the first view controller on the page. Similar, you can use it to go to other pages. Wonder why viewControllers is an array, and not a single view controller? That’s because … Read more

tech