zoukankan      html  css  js  c++  java
  • 设置UITableView背景透明/监听cell左边的删除按钮的点击事件

        _tableView = [[UITableView alloc] init];
        _tableView.delegate   = self;
        _tableView.dataSource = self;
      
    _tableView.frame = CGRectMake(kZero, 66, kScreenW, kScreenH - 66 - 70);
      //设置列表为透明背景
        UIImage *image = [MusicManager createImageWithColor:[UIColor clearColor]];
        _tableView.backgroundView  = [[UIImageView alloc] initWithImage:image];
        _tableView.backgroundColor = [UIColor clearColor];
        
    #pragma mark    设置UITableView背景的代理方法
    -(void)tableView:(UITableView*)tableView  willDisplayCell:(UITableViewCell*)cell forRowAtIndexPath:(NSIndexPath*)indexPath
    {
        [cell setBackgroundColor:[UIColor clearColor]];
    }
    
    #pragma mark   点击cell左边的删除按钮时触发
    - (NSString *)tableView:(UITableView *)tableView titleForDeleteConfirmationButtonForRowAtIndexPath:(NSIndexPath *)indexPath{
     
        //获取当前处于删除状态的cell
        UITableViewCell *cell = [tableView cellForRowAtIndexPath:indexPath];
    
        //获取cell中所有的子控件
        NSArray *labelArray = cell.contentView.subviews;
        for (UIImageView *view in labelArray) {
            if (view.tag == 3) {//向右的图片
                CGRect temp = view.frame;
                temp.origin.x = 255;
                view.frame = temp;
            }
        }
        return @"删除";
    }
    
  • 相关阅读:
    浅析区间问题
    关于参加信息竞赛
    路爷爷语录
    CentOS-7安装python虚拟环境
    开发笔记(不定时更新)
    Redis有序集合的权重值选择
    数据缓存(Redis)流程设计--思路
    Flask框架之配置日志信息
    Flask框架之一对多关系模型定义
    Flask框架之多对多关系模型类的定义
  • 原文地址:https://www.cnblogs.com/hw140430/p/3889580.html
Copyright © 2011-2022 走看看