Question

enter image description hereUsing Pagecurleffect in pageviewcontroller whenever i turn page it overlaps toolbar.

This is my code

- (void)viewDidLoad {

[super viewDidLoad];

modelArray = [[NSMutableArray alloc] init];

for (int index = 1; index <= totalPages; index++) {

    [modelArray addObject:[NSString stringWithFormat:@"%i", index]];

}

thePageViewController = [[UIPageViewController alloc] initWithTransitionStyle:UIPageViewControllerTransitionStylePageCurl navigationOrientation: UIPageViewControllerNavigationOrientationHorizontal options:nil];

thePageViewController.delegate = self;
thePageViewController.dataSource = self;

thePageViewController.view.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;

contentViewController = [[ContentViewController alloc] initWithPDF:PDFDocument];
contentViewController.page = [modelArray objectAtIndex:0];
NSArray *viewControllers = [NSArray arrayWithObject:contentViewController];
[thePageViewController setViewControllers:viewControllers direction:UIPageViewControllerNavigationDirectionForward animated:NO completion:nil];

[self addChildViewController:thePageViewController];
[self.view addSubview:thePageViewController.view];
thePageViewController.view.frame = CGRectMake(0, 0, self.view.frame.size.width, self.view.frame.size.height);


[thePageViewController didMoveToParentViewController:self];

}

In the content view controller using this code in viewdidload

   - (void)viewDidLoad
   {
[super viewDidLoad];


// Create our PDFScrollView and add it to the view controller.
CGPDFPageRef PDFPage = CGPDFDocumentGetPage(thePDF, [_page intValue]);



pdfScrollView = [[PDFScrollView alloc] initWithFrame:CGRectMake(0, 46, self.view.bounds.size.width, 915)];
[pdfScrollView setPDFPage:PDFPage];
[self.view addSubview:pdfScrollView];



    self.view.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;
    pdfScrollView.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;

_toolbar = [[UIToolbar alloc] initWithFrame:CGRectMake(0, 965, self.view.bounds.size.width, 40)];

_toolbar.barStyle = UIBarStyleBlackOpaque;

[self.view addSubview:_toolbar];

   }

Not looking good when it overlaps toolbar while turning page. How i can fix this.

I want like second image

enter image description here

It is turning page under the navigation bar not overlapping navigation bar. Thanks

Était-ce utile?

La solution

You are adding a toolbar in each page, and it's inside the page.

You have to create the toolbar on your first block of code, and add [self.view bringSubviewToTop:_toolbar];at the end

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top