在 UITableView 中执行 commitEditingStyle 时,如何制作“删除按钮"的自定义视图 [英] How can I make a custom view of the 'delete-button' when performing commitEditingStyle within a UITableView

查看:46
本文介绍了在 UITableView 中执行 commitEditingStyle 时,如何制作“删除按钮"的自定义视图的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想自定义在表格视图单元格上执行向左滑动"操作时显示的删除按钮.我目前设置了 UITableViewCell 的子类,但还想自定义正在显示的删除按钮.

I would like to customize the delete button which is shown when performing the 'swipe to left'-action on a tableview cell. I currently set up a subclass of a UITableViewCell but also want to customize the delete-button which is being shown.

我的目标是在滑动时放置三个按钮.

My goal is to place three buttons when swiping.

我选择了另一种实现,我在每个单元格中使用 UIScrollview.

I choose for another implementation where I was using a UIScrollview in each cell.

http://www.teehanlax.com/blog/reproduce-the-ios-7-mail-apps-interface/

推荐答案

这可能对你有帮助.

- (void)willTransitionToState:(UITableViewCellStateMask)state
    {
        [super willTransitionToState:state];
        if ((state & UITableViewCellStateShowingDeleteConfirmationMask) == UITableViewCellStateShowingDeleteConfirmationMask)
        {
            for (UIView *subview in self.subviews)
            {
                if ([NSStringFromClass([subview class]) isEqualToString:@"UITableViewCellDeleteConfirmationControl"])
                {
                    UIImageView *deleteBtn = [[UIImageView alloc]initWithFrame:CGRectMake(0, 0, 64, 33)];
                    [deleteBtn setImage:[UIImage imageNamed:@"arrow_left_s11.png"]];
                    [[subview.subviews objectAtIndex:0] addSubview:deleteBtn];
                }
            }
        }
    }

引用自:

自定义UITableView中的删除按钮

为uitableview创建自定义删除按钮

自定义删除按钮在 UITableView 单元格中编辑

这篇关于在 UITableView 中执行 commitEditingStyle 时,如何制作“删除按钮"的自定义视图的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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