在表格视图中删除时,如何删除确认按钮的阴影?

时间:2017-09-29 10:50:25

标签: ios uitableview

在表格视图中删除时,如何删除确认按钮的阴影?

Shadow of the confirm button

2 个答案:

答案 0 :(得分:0)

首先,只需打开故事板,单击按钮一次以选择它,然后通过单击蓝色箭头将阴影颜色设置为默认

Xcode Sreenshot

override func ViewDidLoad()

中以编程方式尝试以下操作
    self.buttonOutlet.layer.shadowColor = UIColor.white.cgColor
    self.buttonOutlet.layer.shadowOffset = CGSize(width: 0, height: 0)
    self.buttonOutlet.layer.shadowRadius = 0
    self.buttonOutlet.layer.shadowOpacity = 0

buttonOutlet替换为按钮插座的实际名称。

如果有帮助,请告诉我:)。

答案 1 :(得分:0)

我确实解决了这个问题,我们可以自定义这个按钮。 处理TableViewCell。

-(void)layoutIfNeeded {
    [super layoutIfNeeded];
    if ([self.subviews count] >= 4){
        for(UIView* subView in self.subviews){
            //DDLogDebug(@"JARED: subView %@",[subView class]);
            if([NSStringFromClass([subView class]) isEqualToString:@"UITableViewCellEditControl"]){
                for(UIView * subView2 in subView.subviews){

                    if ([subView2 isKindOfClass: [UIImageView class]] && subView2.frame.origin.y == 20) {
                        subView2.layer.shadowRadius  = 11;
                        subView2.layer.shadowColor   = [UIColor whiteColor].CGColor;
                        subView2.layer.shadowOffset  = CGSizeMake(0.0f, 0.0f);
                        subView2.layer.shadowOpacity = 0.1;
                        subView2.layer.cornerRadius  = 11;
                        subView2.layer.masksToBounds = NO;
                        subView2.layer.backgroundColor = [UIColor whiteColor].CGColor;
                        subView2.layer.contents = (id)[UIImage imageNamed:@"confirmDetele"].CGImage;


                    }
                    if ([subView2 isKindOfClass: [UIImageView class]] && subView2.frame.origin.y == 22) {

                        subView2.layer.contents = nil;
                        subView2.layer.shadowRadius  = 11;
                        subView2.layer.shadowColor   = [UIColor whiteColor].CGColor;
                        subView2.layer.shadowOffset  = CGSizeMake(0.0f, 0.0f);
                        subView2.layer.shadowOpacity = 0.1;
                        subView2.layer.cornerRadius  = 11;
                        subView2.layer.masksToBounds = NO;
                        subView2.layer.backgroundColor = [UIColor whiteColor].CGColor;


                    }

                }
            }
        }
    }

}