gpt4 book ai didi

iphone - UIPageViewController 上的圆角

转载 作者:可可西里 更新时间:2023-11-01 06:11:32 25 4
gpt4 key购买 nike

我想知道是否有人成功地将 UIPageViewController(iBooks 的精美翻书动画)的角更改为圆角?

我试过了,但没有用:

[self.notebookPages setViewControllers:viewControllers direction:UIPageViewControllerNavigationDirectionForward animated:NO completion:NULL];
self.notebookPages.dataSource = self.pageModelController;
self.notebookPages.doubleSided = NO;
[self addChildViewController:self.notebookPages];

// mask

CAShapeLayer *maskLayer = [CAShapeLayer layer];
UIBezierPath *roundedPath = [UIBezierPath bezierPathWithRoundedRect:CGRectMake(0, 0, 332, 480)
byRoundingCorners:UIRectCornerTopRight | UIRectCornerBottomRight
cornerRadii:CGSizeMake(15.f, 15.f)];
maskLayer.fillColor = [[UIColor whiteColor] CGColor];
maskLayer.backgroundColor = [[UIColor clearColor] CGColor];
maskLayer.path = [roundedPath CGPath];

self.notebookPages.view.layer.mask = maskLayer;

[self.notebookScrollNavigationController.notebook.pages addSubview:self.notebookPages.view];

self.notebookPages.view.frame = CGRectMake(0, 0, 332, 480);
[self.notebookPages didMoveToParentViewController:self];

这有点硬编码(这显然很糟糕),但我只是想看看圆角是否可行。但是,我只得到一个非圆形的透明角:

enter image description here

最佳答案

添加这个导入:

#import <QuartzCore/QuartzCore.h>

现在你可以使用角半径了:

self.notebookPages.view.layer.cornerRadius = 6;

关于iphone - UIPageViewController 上的圆角,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11939055/

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