设置在UITableViewCell中滑动时显示的删除按钮的高度 [英] Set height of delete button that appears on swipe in UITableViewCell

查看:305
本文介绍了设置在UITableViewCell中滑动时显示的删除按钮的高度的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有UITableViewCell,如下图所示.

该单元格占用了delete占用的高度.设置单元高度以保持两个单元之间的间隔.

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

现在,当我滑动并删除按钮(红色)时,它占据了如上图所示的单元格高度.我只想将其高度设置为仅白色部分的高度,或者说灰色按钮的高度.有人可以帮我设置在UITableViewCell上滑动后出现的删除按钮的高度吗?

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?

推荐答案

在自定义单元格类中使用此代码

Use this code in your custom Cell class

 -(void) layoutSubviews
{
    NSMutableArray *subviews = [self.subviews mutableCopy];
    UIView *subV = subviews[0];
    if ([NSStringFromClass([subV class])isEqualToString:@"UITableViewCellDeleteConfirmationView"]){
      [subviews removeObjectAtIndex:0];
      CGRect f = subV.frame;
      f.size.height = 106; // Here you set height of Delete button
      subV.frame = f;
     }

}

这篇关于设置在UITableViewCell中滑动时显示的删除按钮的高度的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆