I am using this code to make a view with one corner round :
-(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
}
But I am not able to drop shadow of the view.
Thanks...
try this one where you are declaring your UIBeizerPath
UIBezierPath *maskPath = [UIBezierPath bezierPathWithRoundedRect:button.bounds byRoundingCorners:UIRectCornerTopLeft | UIRectCornerTopRight cornerRadii:CGSizeMake(7.0, 7.0)];
maskLayer.shadowPath = maskPath.CGPath;
hope it helps...
I am not sure why you are using Shape Layer and stuff. If you just need a drop shadow you can check the method in this link
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.