Hide Dots from Uipageviewcontroller

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 indicator is visible.

Remove the page indicator from UIPageViewController

The dots are added once your UIPageViewController datasource implements the following methods:

presentationCountForPageViewController:
presentationIndexForPageViewController:

Avoid to implement those to get rid of the UIPageControl dots.

page view controller hide indicator dots and stop in the last page (can't come back)

Change this, which is making the page view to return to the first one when it is in the last one:

let nextIndex = viewControllerIndex+1
guard nextIndex < VCArr.count
else {
return nil //was VCArr.first
}

And to make it hidden, first move the let pageVC = UIPageControl() below the class pageVC : UIPageViewController , UIPageViewControllerDataSource , UIPageViewControllerDelegate { to make it public within the class. Then add:

if nextIndex == VCArr.count{
pageVC.isHidden = true
}

Hide counter dots of UIPageViewController on last page

You can use UIPageControl and hide it when you reach at last page. You can detect last page view delegate methods.
You can find if current page is last page in this delegate method

- (void)pageViewController:(UIPageViewController *)pageViewController didFinishAnimating:(BOOL)finished previousViewControllers:(NSArray *)previousViewControllers transitionCompleted:(BOOL)completed{

}

Dynamically hide or position video above dots in UIPageViewcontroller (e.g., UIPageControl)?

Swift 4 answer to dynamically hide dots:

Works:

for subview in self.view.subviews {
if subview is UIPageControl {
subview.isHidden = true
}
}

Fails:

let pageControl = UIPageControl.appearance(whenContainedInInstancesOf: [type(of: self)])
pageControl.isHidden = true

How to remove the bottom gap of UIPageViewController

Finally got the solution myself I just hide the page control from UIViewPageController and then extended the size of the UIPageViewController to cover up the gap left due to absense of page control.

 NSArray *subviews = self.pageController.view.subviews;
UIPageControl *thisControl = nil;
for (int i=0; i<[subviews count]; i++) {
if ([[subviews objectAtIndex:i] isKindOfClass:[UIPageControl class]]) {
thisControl = (UIPageControl *)[subviews objectAtIndex:i];
}
}

thisControl.hidden = true;
self.pageController.view.frame = CGRectMake(0, 0, self.view.frame.size.width, self.view.frame.size.height+40);

How to hide the background of dots in a Page View in Swift?

If you check in the example link you have provided, i found some difference which you may help you in the implementation

1. // We need to cover all the control by making the frame taller (+ 37)

[[self.pageController view] setFrame:CGRectMake(0, 0, [[self view] bounds].size.width, [[self view] bounds].size.height + 37)];

- Added extra height in the PageViewController so default page controller bottom bar is hidden

// Bring the common controls to the foreground (they were hidden since the frame is taller)

2.

[self.view bringSubviewToFront:self.pcDots];

The trick is put the PageControl in the foreground at bottom. put UIPageControl and set the value of it in the delegate method of UIPageController


If you need the full demo implementation of UIPageController you can check the tutorial here:https://spin.atomicobject.com/2015/12/23/swift-uipageviewcontroller-tutorial/

At the end of this tutorial you will get the custom UIPageController which you want, if you want to set the page control at bottom change the position of UIPageControl in the TutorialViewController in storyboard



Related Topics



Leave a reply



Submit