如何摆脱右侧阴影但保持按钮底部阴影

How to get rid right side shadow but maintain bottom shadow on button

我有创建一行按钮的循环,我有以下代码来设置阴影。如何去除右侧阴影但保持底部阴影?

    button.imageView.layer.cornerRadius = 7.0f;
    button.layer.shadowRadius = 1.0f;
    button.layer.shadowColor = [UIColor blackColor].CGColor;
    button.layer.shadowOffset = CGSizeMake(0.0f, 2.0f);
    button.layer.shadowOpacity = 0.5f;
    button.layer.masksToBounds = NO;

回答

按照提示添加了UIView

navigationView = [[UIView alloc]initWithFrame:CGRectMake(X_BUFFER+5,Y_POS_BTN,self.view.frame.size.width-10,HEIGHT_BTN)];
navigationView.backgroundColor = [UIColor whiteColor];

[self.view addSubview:navigationView];

UIBezierPath *shadowPath = [UIBezierPath bezierPathWithRect:self.navigationView.bounds];
self.navigationView.layer.masksToBounds = NO;
self.navigationView.layer.shadowColor = [UIColor blackColor].CGColor;
self.navigationView.layer.shadowOffset = CGSizeMake(5.0f, 5.0f);
self.navigationView.layer.shadowOpacity = 0.8f;
self.navigationView.layer.shadowPath = shadowPath.CGPath;