【问题标题】:Navigation bar stops working after applying a layer mask应用图层蒙版后导航栏停止工作
【发布时间】:2012-03-02 12:44:57
【问题描述】:

我使用 CAShapeLayer 创建了一个蒙版,我在左上/右上方设置了圆角,然后将其应用于我的 navigationControllernavigationBar

它就像一个魅力,但我现在注意到我不能使用导航栏上的按钮!

这是我使用的代码(viewDidLoad):

UIBezierPath *maskPath = [UIBezierPath bezierPathWithRoundedRect:self.navigationController.navigationBar.bounds
                                               byRoundingCorners:UIRectCornerTopLeft | UIRectCornerTopRight
                                                     cornerRadii:CGSizeMake(6.0, 6.0)];

CAShapeLayer *maskLayer = [CAShapeLayer layer];
maskLayer.frame = self.navigationController.navigationBar.bounds;
maskLayer.path = maskPath.CGPath;

self.navigationController.navigationBar.layer.mask = maskLayer;

【问题讨论】:

    标签: cocoa-touch ios5 core-graphics uibezierpath cashapelayer


    【解决方案1】:

    您需要在设置图层蒙版后以编程方式设置按钮。

    【讨论】:

    • 你这是什么意思?如何设置它们?
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-12-09
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多