Set height of delete button that appears on swipe in UITableViewCell

后端 未结 5 775
独厮守ぢ
独厮守ぢ 2021-02-10 18:25

\"enterI have UITableViewCell as shown in figure below.

The cell occupy the h

5条回答
  •  面向向阳花
    2021-02-10 18:49

    Add this method to your customCell.m file.

    -(void) layoutSubviews
    {
        NSMutableArray *subviews = [self.subviews mutableCopy];
        UIView *subview = subviews[0];
    
        if ([NSStringFromClass([subview class])isEqualToString:@"UITableViewCellDeleteConfirmationView"]){
            UIView *deleteButtonView = (UIView *)[subview.subviews objectAtIndex:0];
            CGRect buttonFrame = deleteButtonView.frame;
            buttonFrame.origin.x = deleteButtonView.frame.origin.x;
            buttonFrame.origin.y = deleteButtonView.frame.origin.y;
            buttonFrame.size.width = deleteButtonView.frame.size.width;
            buttonFrame.size.height = 46;
            deleteButtonView.frame = buttonFrame;
            subview.frame=CGRectMake(subview.frame.origin.x, subview.frame.origin.y, subview.frame.size.width, 46);
            deleteButtonView.clipsToBounds=YES;
            subview.clipsToBounds=YES;
        }
    }
    

提交回复
热议问题