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 @"删除";
    }
    
  • 相关阅读:
    putty设置用key自动登录
    linux快速进入全屏命令行模式
    二维数组的指针
    vim编写Bash脚本
    使用cat命令添加或附加多行文本
    Linode中的Network Helper
    网络通信框架之retrofit
    网络通信框架之okHttp
    网络通信框架之okHttpUtils
    Volley源码分析
  • 原文地址:https://www.cnblogs.com/hw140430/p/3889580.html
Copyright © 2011-2022 走看看