Remove page indicator from UIPageViewController
I am using a pageview controller in an iOs app. How do I remove points from this controller?
- (void)viewDidLoad
{
[super viewDidLoad];
// Do any additional setup after loading the view.
self.dontShowChecked = NO;
self.imagesArray = @[ ..];
self.textsArray = @[ ........
];
// Create page view controller
self.pageViewController = [self.storyboard instantiateViewControllerWithIdentifier:@"WTPageController"];
self.pageViewController.dataSource = self;
WTDetailViewController *startingViewController = [self viewControllerAtIndex:0];
NSArray *viewControllers = @[startingViewController];
[self.pageViewController setViewControllers:viewControllers direction:UIPageViewControllerNavigationDirectionForward animated:NO completion:nil];
// Change the size of page view controller
CGFloat delta = [[PSDeviceInfo sharedInstance] is_iPhone] ? 50. : 50;
self.pageViewController.view.frame = CGRectMake(0, 40., self.view.frame.size.width, self.view.frame.size.height - delta);
[self.view addSubview:_pageViewController.view];
[self.pageViewController didMoveToParentViewController:self];
}
Dots seem to be automatically added and interfere with other UI elements in this area. How do I completely remove them?
+3
source to share
3 answers
If the pages are zoomed in or out dynamically .
So, I used below method which will manually hide the component itself.
func togglePageControl(pageCount: Int, threshold: Int = 1) {
var hidden = true
if pageCount > threshold {
hidden = false
}
for subView in self.view.subviews {
if subView is UIScrollView {
subView.frame = self.view.bounds
} else if subView is UIPageControl {
subView.isHidden = hidden
}
}
}
And it needs to be called from
public func presentationCount(for pageViewController: UIPageViewController) -> Int {
togglePageControl(pageCount: pages.count)
// or togglePageControl(pageCount: pages.count, threshold: 5)
return pages.count
}
+1
source to share