Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Set height of delete button that appears on swipe in UITableViewCell

enter image description hereI have UITableViewCell as shown in figure below.

The cell occupy the height occupied by delete. The cell height is set so as to keep spacing between two cell.

Now, when i swipe and delete button appears (red in color), it occupies cell height as given in picture above. I simply want to set its height to height of white part only or say the height of gray button. Can anyone help me on how to set the height of delete button that appears after swipe in UITableViewCell?

like image 705
Lasang Avatar asked Dec 05 '22 06:12

Lasang


1 Answers

The best way to solve this was overriding

-(void)layoutSubviews in YourCustomCell:UITableViewCell    

then

if ([NSStringFromClass([subview class])isEqualToString:@"UITableViewCellDeleteConfirmationControl"]){
            UIView *deleteButtonView = (UIView *)[subview.subviews objectAtIndex:0];
                                CGRect buttonFrame = deleteButtonView.frame;
                                buttonFrame.origin.x = Xvalue;
                                buttonFrame.origin.y = Yvalue;
                                buttonFrame.size.width = Width;
                                buttonFrame.size.height = Height;
                                deleteButtonView.frame = buttonFrame;

         }
like image 146
Suhail kalathil Avatar answered Jun 02 '23 01:06

Suhail kalathil