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 @"删除";
    }
    
  • 相关阅读:
    0814防盗链访问控制代理
    0811Nginx访问日志设置
    0810Nginx安装
    0809LNMP架构介绍
    PHP安装
    mariaDB安装Apache安装(httpd)
    LAMP构架介绍
    shell基础知识(2)
    shell基础知识(1)
    yum更换国内源、yum下载rpm包、源码包安装
  • 原文地址:https://www.cnblogs.com/hw140430/p/3889580.html
Copyright © 2011-2022 走看看