美文网首页
UITableViewCellReorderControl 改变

UITableViewCellReorderControl 改变

作者: Peter杰 | 来源:发表于2020-08-12 21:56 被阅读0次

    方法一:改在Controller里面

    - (void)tableView:(UITableView *)tableView willDisplayCell:(UITableViewCell *)cell forRowAtIndexPath:(NSIndexPath *)indexPath
    {
        if (self.tableView.editing)
        {
            for (UIView * view in cell.subviews)
            {
                if ([NSStringFromClass([view class]) rangeOfString: @"UITableViewCellReorderControl"].location != NSNotFound)
                {
                    for (UIView * subview in view.subviews) {
                        if ([subview isKindOfClass: [UIImageView class]])
                        {
                            ((UIImageView *)subview).image = [UIImage imageNamed: @"accessory_next"];
                        }
                    }
                }
            }
        }
    }
    

    方法二:改在UITableViewCell里面

      - (void) setEditing:(BOOL)editing animated:(BOOL)animated
    {
        [super setEditing: editing animated: YES];
    
        if (editing) {
    
            for (UIView * view in self.subviews) {
                if ([NSStringFromClass([view class]) rangeOfString: @"Reorder"].location != NSNotFound) {
                    for (UIView * subview in view.subviews) {
                        if ([subview isKindOfClass: [UIImageView class]]) {
                            ((UIImageView *)subview).image = [UIImage imageNamed: @"yourimage.png"];
                        }
                    }
                }
            }
        }   
    }
    

    相关文章

      网友评论

          本文标题:UITableViewCellReorderControl 改变

          本文链接:https://www.haomeiwen.com/subject/qvhmdktx.html