I have a UIPageViewController
set up to display pages of UITableViewController
content. The functionality is working just fine, but the table is hidden at the top and there is a strange black bar at the bottom.
So the first thing I did was go to the storyboard and change the settings for my UIPageViewController
as shown below.
The resulting view renders like this:
Ideally I would like the pager background to be translucent so that you can see the table below it. Also, although the top of the table is now visible, I don't like how the background has changed to a weird grey/translucent effect. Any suggestions on how to fix?
The color of the UIPageControl
is already clear. So, what you're seeing is the black background of the UIPageViewController
peeking through. The problem is that the UIPageViewController
restricts the size of the view controller to not extend beneath the UIPageControl
.
Add this following code to your UIPageViewController class to allow your viewController to extend underneath the UIPageControl
:
override func viewDidLayoutSubviews() {
//corrects scrollview frame to allow for full-screen view controller pages
for subView in self.view.subviews {
if subView is UIScrollView {
subView.frame = self.view.bounds
}
}
super.viewDidLayoutSubviews()
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With