Davis
Davis

Reputation: 1263

Add Custom View on UIPageViewController

I want to add a Custom View (red View) on the bottom of my UIPageViewController like this:

enter image description here

Because i want some Standard Text which is displayed on every View of my UIPageViewController. Everythings works fine, but my Custom VIew is not visible, this is what i tried:

- (void)viewDidLoad
{
self.pageController = [[UIPageViewController alloc] initWithTransitionStyle:UIPageViewControllerTransitionStylePageCurl navigationOrientation:UIPageViewControllerNavigationOrientationHorizontal options:nil];

self.pageController.dataSource = self;
[[self.pageController view] setFrame:[[self view] bounds]];

FirstTutorialViewController *initialViewController = [self viewControllerAtIndex:0];

NSArray *viewControllers = [NSArray arrayWithObject:initialViewController];

[self.pageController setViewControllers:viewControllers direction:UIPageViewControllerNavigationDirectionForward animated:NO completion:nil];


[self addChildViewController:self.pageController];
[[self view] addSubview:[self.pageController view]];
[self.pageController didMoveToParentViewController:self];

//Here i try to set the Custom view:
 [[self.pageController view] addSubview:[self customView]];

Upvotes: 0

Views: 1280

Answers (1)

Wain
Wain

Reputation: 119021

Don't add self customView to the page controller, and be sure to set its frame first.

Instead, resize the page controller to allow space at the bottom for the custom view and add both to your main view.

Upvotes: 1

Related Questions