cuốn sách gpt4 ai đã làm

ios - UINavigationController 阴影

In lại Tác giả: Walker 123 更新时间:2023-11-29 01:40:19 32 4
mua khóa gpt4 Nike

尝试遵循概述的方法 đây为我的 UINavigationController 添加阴影。但是,该方法似乎不起作用。

这是我使用的代码:

- (void)viewDidLoad
{
[super viewDidLoad];

// ..... etc. ....

self.navigationController.view.layer.shadowPath = [UIBezierPath bezierPathWithRoundedRect:self.navigationController.view.bounds cornerRadius:self.navigationController.view.layer.cornerRadius].CGPath;
[self.navigationController.view.layer setMasksToBounds: NO];
[self.navigationController.view.layer setShadowColor: [UIColor blackColor].CGColor];
[self.navigationController.view.layer setShadowOffset: CGSizeMake(0, 1)];
[self.navigationController.view.layer setShadowRadius:3];
[self.navigationController.view.layer setShadowRadius: 4.0];
[self.navigationController.view.layer setShadowOpacity: 0.25];

没有阴影 :((见照片)。

nhập mô tả hình ảnh ở đây

有什么想法吗?感谢您的任何输入。

câu trả lời hay nhất

这对我有用:尝试将您设置的任何内容设置为导航栏而不是导航 Controller :nhập mô tả hình ảnh ở đây r

self.nvBar.layer.shadowPath = [UIBezierPath bezierPathWithRoundedRect:self.nvBar.bounds cornerRadius:self.nvBar.layer.cornerRadius].CGPath;
[self.nvBar.layer setShadowColor: [UIColor redColor].CGColor];
[self.nvBar.layer setShadowOffset: CGSizeMake(0, 13)];
[self.nvBar.layer setShadowRadius:3];
[self.nvBar.layer setShadowRadius: 4.0];
[self.nvBar.layer setShadowOpacity: 0.15];

关于ios - UINavigationController 阴影,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32463828/

32 4 0
Chứng chỉ ICP Bắc Kinh số 000000
Hợp tác quảng cáo: 1813099741@qq.com 6ren.com
Xem sitemap của VNExpress