0

我正在使用此代码制作一个圆角的视图:

-(IBAction)goToSpecificPage:(UIButton *)sender {

 skipButtonBackgroundView = [[UIView alloc] initWithFrame:CGRectMake(self.view.bounds.size.width-400, 0.0f, 400.0f, 55.0f)];

    UIColor *backGroundColor = [UIColor colorWithRed:0.85098039215 green:0.85098039215 blue:0.85098039215 alpha:1];

    skipButtonBackgroundView.backgroundColor = backGroundColor;       

    UIBezierPath *maskPath = [UIBezierPath bezierPathWithRoundedRect:skipButtonBackgroundView.bounds byRoundingCorners:UIRectCornerBottomLeft                                                      cornerRadii:CGSizeMake(10.0, 10.0)];   

    // Create the shape layer and set its path

    CAShapeLayer *maskLayer = [CAShapeLayer layer];    
    maskLayer.frame = skipButtonBackgroundView.bounds;    
    maskLayer.path = maskPath.CGPath;    
    skipButtonBackgroundView.layer.mask = maskLayer;    
    [self.view addSubview:skipButtonBackgroundView];  // Drop shadow    
}

但我无法删除视图的阴影。

谢谢...

4

2 回答 2

0

试试这个你要声明你的UIBeizerPath

UIBezierPath *maskPath = [UIBezierPath bezierPathWithRoundedRect:button.bounds byRoundingCorners:UIRectCornerTopLeft | UIRectCornerTopRight cornerRadii:CGSizeMake(7.0, 7.0)];

maskLayer.shadowPath = maskPath.CGPath;

希望能帮助到你...

于 2013-06-07T06:08:49.623 回答
0

我不确定您为什么要使用形状图层之类的东西。如果您只需要一个阴影,您可以检查此链接中的方法

于 2013-06-07T06:09:17.243 回答