gpt4 book ai didi

iphone - pageviewcontroller 中的 PageCurlEffect 与工具栏重叠

转载 作者:行者123 更新时间:2023-12-03 20:51:16 26 4
gpt4 key购买 nike

enter image description here每当我翻页时,在 pageviewcontroller 中使用 Pagecurleffect 它会与工具栏重叠。

这是我的代码

- (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];

}

在内容 View Controller 中使用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];

}

翻页时与工具栏重叠时看起来不太好。我该如何解决这个问题。

我想要第二张图片

enter image description here

在导航栏下翻页,不与导航栏重叠。谢谢

最佳答案

您要在每个页面中添加一个工具栏,它位于页面内部。

您必须在第一个代码块上创建工具栏,并在末尾添加 [self.viewbringSubviewToTop:_toolbar];

关于iphone - pageviewcontroller 中的 PageCurlEffect 与工具栏重叠,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17412217/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com