Iphone 淡入UITableView编辑模式的淡入淡出图像?

Iphone 淡入UITableView编辑模式的淡入淡出图像?,iphone,objective-c,uitableview,Iphone,Objective C,Uitableview,我有一个自定义的UITableViewCell类,每个单元格都有一个我给它的UIImageView 我要做的就是在进入编辑模式时淡出此图像,在退出编辑模式时将其淡出。在custome cell类中编写以下方法 - (void)tableView:(UITableView *)tableView willBeginEditingRowAtIndexPath:(NSIndexPath *)indexPath { //detect editing mode for (UITableViewCe

我有一个自定义的UITableViewCell类,每个单元格都有一个我给它的UIImageView


我要做的就是在进入编辑模式时淡出此图像,在退出编辑模式时将其淡出。

在custome cell类中编写以下方法

- (void)tableView:(UITableView *)tableView willBeginEditingRowAtIndexPath:(NSIndexPath *)indexPath {
//detect editing mode
    for (UITableViewCell *cell in self.tableView.visibleRows) { // loop through the visible cells and animate their imageViews

         [UIView animateWithDuration:1.0
                 delay:0
                 animations: ^{ cell.imageView.alpha = 0.5; }
                 completion: ^(BOOL finished) { cell.imageView.alpha = 1.0; }
         }];
    }

}
- (void)setEditing:(BOOL)editing animated:(BOOL)animated{
     [super setEditing:editing animated:animated];
     if (editing) {
   PUT YOUR fade animation code here
     }  

}

此方法是UITableView还是UITableViewCell的一部分?我在任何地方都找不到关于它的任何信息。我以前编的方法,这个方法(其完整形式应记录在UITableViewDelegate下。抱歉,您失去了我。您只引用了
didEnterEditingMode
,我认为这是您编写的?记录的是哪种方法?我已使用记录的方法更新了代码。该方法是
-(void)tableView:(UITableView*)tableView将开始编辑RowAtIndexPath:(NSIndexPath*)indexPath
这很有效,谢谢,但是有没有办法区分按下编辑按钮和滑动删除?因为我只需要在点击编辑按钮时执行此操作,滑动不会引起问题。