0

I would like to add a button to my UIPageViewController just like the bottom right button of the iOS Weather app. I would like to know what is most correct and clean way of doing it. Should I access the PageControl somehow and add a subview with the button I want to add or should I hide the Page Control and add a toolbar at the bottom of the view? Any simple snippet would be most welcome. Thank you!

Mig70
  • 61
  • 10
  • I embedded the PageViewController inside another view controller and added a transparent view with a botton, at the bottom of this view controller, which stands on top of the PageViewControoler. It works but I do not find it a very elegant approach. – Mig70 Jul 05 '16 at 14:19

1 Answers1

0
  1. In viewDidLoad, add the button to the UIPageViewController's view.
  2. In viewDidAppear, bring the button to front

```

- (void)viewDidLoad {
  [super viewDidLoad];

  // Add the button
  [self.view addSubview:button];
}

- (void)viewDidAppear:(BOOL)animated {
  [super viewDidAppear:animated];

  // Bring it to front so it appears in front of the UIPageControl
  [self.view bringSubviewToFront:button];
}

```

user3246173
  • 488
  • 6
  • 18