Serluca
Serluca

Reputation: 2102

UIWebView inside UIPageViewController with UINavigationBar

I created a project with a UIPageViewController embedded in UINavigationController in the storyboard. This pageController has 2 UIViewController with inside an instance of UIWebViewController. The problem is that the web view appear under the top bar.

Do you have any idea for solve this?

Note: I don't want to use self.edgesForExtendedLayout = UIRectEdgeNone; for solve this problem because I want that my web view will be visible under the NavigationBar

This is the PageViewController:

DataViewController *startingViewController = [self.modelController viewControllerAtIndex:0 storyboard:self.storyboard];
NSArray *viewControllers = @[startingViewController];
[self setViewControllers:viewControllers direction:UIPageViewControllerNavigationDirectionForward animated:NO completion:nil];
self.dataSource = self.modelController;

This is the DataViewController:

[self.webView loadHTMLString:@"...My Html..." baseURL:nil];
[self.webView setDelegate:self];

The ModelController is the same of Apple Example Project

And this is the storyboard: enter image description here

Upvotes: 1

Views: 906

Answers (1)

Arpit
Arpit

Reputation: 742

If you wants to start the UIWebView under the Navigation Bar then there is one easier way to do .

Follow the below steps:

  1. Select your ViewController in Storyboard.
  2. In Attributes Inspector, there is one option in ViewController "Under Top Bars" uncheck this option.

After that your view will starts from the completion of the navigation Bar.

I think it will solve your problem..

Upvotes: 2

Related Questions