Ios 如果使一个角变圆,则无法除去视图的阴影
我正在使用此代码创建一个角圆视图:Ios 如果使一个角变圆,则无法除去视图的阴影,ios,Ios,我正在使用此代码创建一个角圆视图: -(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.8
-(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
}
但我无法投下视野的阴影
谢谢…在声明您的
UIBeizerPath
UIBezierPath *maskPath = [UIBezierPath bezierPathWithRoundedRect:button.bounds byRoundingCorners:UIRectCornerTopLeft | UIRectCornerTopRight cornerRadii:CGSizeMake(7.0, 7.0)];
maskLayer.shadowPath = maskPath.CGPath;
希望对您有所帮助……我不知道您为什么要使用Shape Layer之类的东西。如果您只需要放置阴影,您可以在此检查方法我希望我的视图具有一个圆角和放置阴影我已经解决了这个问题。实际上,我需要一个技巧来应用阴影和圆角动画。为此,我在一个视图中添加了圆角,在另一个视图中添加了阴影,最后在主视图下添加了两个视图..)