how can I change the height of UITableViewRowAction in swift?

137 Views Asked by At

enter image description here

I have a cell where the bottom 10px ish is used as a seperator. I want to make the UITableViewRowAction to be the same height as the inner view without the seperator but swift does not seem to support this kind of functionality..

Is there any way to do this?

1

There are 1 best solutions below

1
On

you can change the size of the Delete button by

 -(void)didTransitionToState:(UITableViewCellStateMask)state
 {
       [super didTransitionToState:state];
       if ((state & UITableViewCellStateShowingDeleteConfirmationMask) == UITableViewCellStateShowingDeleteConfirmationMask)
       {

          UIView *deleteButton = [self deleteButtonSubview:self];
          if (deleteButton)
          {
             CGRect frame = deleteButton.frame;
             frame.origin.y = 4;
             frame.size.height = frame.size.height-8;
             /*
             if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad)
             {
                //use your desired size for iPad
                frame.size.height = 62; 
                frame.size.width = 80;

             }
             else
             {
                //use your desired size for iPhone
                frame.size.height = 52; 
                frame.size.width = 80;

             }
              */
             deleteButton.frame = frame;

         }
     }
}

- (UIView *)deleteButtonSubview:(UIView *)view
{
    if ([NSStringFromClass([view class]) rangeOfString:@"Delete"].location != NSNotFound) {
        return view;
    }
    for (UIView *subview in view.subviews) {
        UIView *deleteButton = [self deleteButtonSubview:subview];
        [deleteButton setBackgroundColor:[UIColor whiteColor]];
        if (deleteButton) {

            return deleteButton;
        }
    }
    return nil;
}