zoukankan      html  css  js  c++  java
  • 关于tableviewcell的一些必备常识

    1.设置tableview的背景颜色当设置tableview.backgroundcolor无效时,这样设置:

        UIView *view    = [[UIView alloc] initWithFrame:_tableView.frame];

          view.backgroundColor    = UIColorFromRGB(0x1f2f4b);

         _tableView.backgroundView   = view;  

    2.想设置cell选中时不想要样式,应该这样设置:

          UIView* view = [[UIView alloc]initWithFrame:cell.frame];

            view.backgroundColor    = [UIColor clearColor];

            cell.selectedBackgroundView     = view;

    3.设置多选:

       _tableView.allowsMultipleSelectionDuringEditing = YES;

    4.当不想看到tableview没有cell的地方的分割线时,应该这样设置:

       _tableView.tableFooterView  = [[UITableView alloc] init];

    5.当为tableview加入手势如tap时,datasource的didselect那个方法事件会被覆盖,此时需要实现tap的代理方法去判断移除:

      - (BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldReceiveTouch:(UITouch *)touch

      {

          NSString *className = NSStringFromClass([touch.view class]);

          // 若为UITableViewCellContentView(即点击了tableViewCell),则不截获Touch事件

          if ([className isEqualToString:@"UITableViewCellContentView"]) {  

              return  NO;

          }

          return  YES;

      }

    6.隐藏tableviewcell的分割线:

       _tableView.separatorStyle   = UITableViewCellSeparatorStyleNone;

      本人在编程方面的时间可能不长,写的博客可能不怎么好,如对本人的博客有异议的,欢迎来给出意见。

  • 相关阅读:
    addslashes与mysql_real_escape_string的区别
    gcc
    php函数
    JAVA基本类库介绍
    Linux系统精华教程
    CJIAN
    我的未来不是梦! 全新时代
    html标签属性disabled用法 全新时代
    javamail收取邮件demo code 全新时代
    TortoiseSVN安装注意事项及中文语言包安装 全新时代
  • 原文地址:https://www.cnblogs.com/destiLaugh/p/5829253.html
Copyright © 2011-2022 走看看