Increase the size of the indicator in UIPageViewController’s UIPageControl

Scaling the page control will scale the dots, but will also scale the spacing in between them. pageControl.transform = CGAffineTransform(scaleX: 2, y: 2) If you want to keep the same spacing between dots, you’ll need to transform the dots individually: pageControl.subviews.forEach { $0.transform = CGAffineTransform(scaleX: 2, y: 2) } However, if you do this in … Read more

PageViewController current page index in Swift

You can use didFinishAnimating, and set tags to viewcontrollers. try this func pageViewController(pageViewController: UIPageViewController, didFinishAnimating finished: Bool, previousViewControllers: [UIViewController], transitionCompleted completed: Bool) { if (!completed) { return } self.pageControl.currentPageIndex = pageViewController.viewControllers!.first!.view.tag //Page Index }

How to create a Scroll View with a page control using swift? [closed]

import UIKit class DummyVC: UIViewController, UIScrollViewDelegate { let scrollView = UIScrollView(frame: CGRect(x:0, y:0, width:320,height: 300)) var colors:[UIColor] = [UIColor.red, UIColor.blue, UIColor.green, UIColor.yellow] var frame: CGRect = CGRect(x:0, y:0, width:0, height:0) var pageControl : UIPageControl = UIPageControl(frame: CGRect(x:50,y: 300, width:200, height:50)) override func viewDidLoad() { super.viewDidLoad() configurePageControl() scrollView.delegate = self scrollView.isPagingEnabled = true self.view.addSubview(scrollView) for index … Read more

How can I change the page on clicking the dots of UIPageControl

You can create one event change page: – (IBAction)changePage:(id)sender { UIPageControl *pager=sender; int page = pager.currentPage; CGRect frame = imageGrid_scrollView.frame; frame.origin.x = frame.size.width * page; frame.origin.y = 0; [imageGrid_scrollView scrollRectToVisible:frame animated:YES]; } Bind it to Pagecontrol’s value changed event.

How to add PageControl inside UICollectionView Image Scrolling

I’m not a fan of the accepted answer. From time to time, willDisplay cell will return the wrong page for the page control depending on users interaction. What I use: func scrollViewDidEndDecelerating(_ scrollView: UIScrollView) { pageControl.currentPage = Int(scrollView.contentOffset.x) / Int(scrollView.frame.width) } This will update the page after the user has finished scrolling thus making the … Read more

Programmatically Linking UIPageControl to UIScrollView

Maybe this works for you Don’t forget to set the UIScrollView’s delegate = self (or wherever you have the selector below). – (void)scrollViewDidScroll:(UIScrollView *)scrollView { CGFloat pageWidth = self.scrollView.frame.size.width; // you need to have a **iVar** with getter for scrollView float fractionalPage = self.scrollView.contentOffset.x / pageWidth; NSInteger page = lround(fractionalPage); self.pageControl.currentPage = page; // you … Read more

Hide dots from UIPageViewController

The page control is only displayed if the datasource implements these methods: presentationCountForPageViewController: presentationIndexForPageViewController: Simply remove your implementation of these, and the page control will not be displayed. From the datasource docs: If both of the methods in “Supporting a Page Indicator” are implemented and the page view controller’s transition style is UIPageViewControllerTransitionStyleScroll, a page … Read more

How to put the UIPageControl element on top of the sliding pages within a UIPageViewController?

I didn’t have the rep to comment on the answer that originated this, but I really like it. I improved the code and converted it to swift for the below subclass of UIPageViewController: class UIPageViewControllerWithOverlayIndicator: UIPageViewController { override func viewDidLayoutSubviews() { for subView in self.view.subviews as! [UIView] { if subView is UIScrollView { subView.frame = … Read more