自定义视图的UITableView内进行commitEditin

自定义视图的UITableView内进行commitEditin

本文介绍了我怎样才能让“删除按钮”的自定义视图的UITableView内进行commitEditingStyle时的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想自定义的删除按钮上的tableview细胞进行刷卡到left'动作时被显示。我公司目前成立了一个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.

推荐答案

这可能会帮助你。

- (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];
                }
            }
        }
    }

从引用:

Customize在UITableView的删除按钮

Custom删除按钮编辑在UITableView的细胞

这篇关于我怎样才能让“删除按钮”的自定义视图的UITableView内进行commitEditingStyle时的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-22 23:35