我正在使用此代码创建一个角落的视图:
-(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
}
但我无法放下视线的阴影。
...谢谢
答案 0 :(得分:0)
尝试使用您声明UIBeizerPath
UIBezierPath *maskPath = [UIBezierPath bezierPathWithRoundedRect:button.bounds byRoundingCorners:UIRectCornerTopLeft | UIRectCornerTopRight cornerRadii:CGSizeMake(7.0, 7.0)];
maskLayer.shadowPath = maskPath.CGPath;
希望它有所帮助...
答案 1 :(得分:0)
我不确定你为什么要使用Shape Layer和东西。如果您只需要投影,可以查看此link
中的方法