第一条:UITableViewCell 内容的设置
//文本放到最后
NSIndexPath *indexPath = [NSIndexPath indexPathForRow:_dataArr.count - 1 inSection:0];
[_tableView scrollToRowAtIndexPath:indexPath atScrollPosition:UITableViewScrollPositionBottom animated:YES];
 
//刷新指定cell
NSIndexPath *indexPath_3=[NSIndexPath indexPathForRow:0 inSection:2];
NSArray *indexArray3=[NSArray arrayWithObject:indexPath_3];
[self.tableview reloadRowsAtIndexPaths:indexArray3 withRowAnimation:UITableViewRowAnimationAutomatic];
 
 
第二条:UITableViewCell分割线左边部分缺少一些的解决方法
-(void)viewDidLayoutSubviews {
  if ([self.tableView respondsToSelector:@selector(setSeparatorInset:)]) {
    [self.tableView setSeparatorInset:UIEdgeInsetsZero];
  }
  if ([self.tableView respondsToSelector:@selector(setLayoutMargins:)])  {
    [self.tableView setLayoutMargins:UIEdgeInsetsZero];
  }
}
 
-(void)tableView:(UITableView *)tableView willDisplayCell:(UITableViewCell *)cell forRowAtIndexPath:(NSIndexPath *)indexPath{
   
  if ([cell respondsToSelector:@selector(setLayoutMargins:)]) {
    [cell setLayoutMargins:UIEdgeInsetsZero];
  }
  if ([cell respondsToSelector:@selector(setSeparatorInset:)]){
    [cell setSeparatorInset:UIEdgeInsetsZero];
  }
}
 
第三条:UITableView的分割线部分不显示的问题?
simulator -> debug -> optimize rendering for window scale 取消打勾就好
 
 
第四条: 自定义cell分割线大致用到的两种方法
 
   a、把自定义的分割线当成一个View放到cell的contentView上,一定要注意重用问题,所以这个view 要在cell初始化的时候添加上。示例代码如下:
 

p.p1 { margin: 0.0px 0.0px 0.0px 0.0px; font: 18.0px Menlo; color: #000000 }
p.p2 { margin: 0.0px 0.0px 0.0px 0.0px; font: 18.0px Menlo; color: #6122ae }
p.p3 { margin: 0.0px 0.0px 0.0px 0.0px; font: 18.0px Menlo; color: #3e1e81 }
p.p4 { margin: 0.0px 0.0px 0.0px 0.0px; font: 18.0px Menlo; color: #000000; min-height: 21.0px }
p.p5 { margin: 0.0px 0.0px 0.0px 0.0px; font: 18.0px Menlo; color: #1e9421 }
span.s1 { }
span.s2 { color: #6122ae }
span.s3 { color: #000000 }
span.s4 { color: #c42275 }
span.s5 { color: #c81b13 }
span.s6 { color: #703daa }
span.s7 { color: #3e1e81 }
span.s8 { color: #0435ff }

  - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath * )indexPath{

   UITableViewCell *cell =nil;

  cell = [tableView dequeueReusableCellWithIdentifier:@"cell"];

   if (cell ==nil) {

   cell= [[UITableViewCell alloc]initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:@"cell"];

    cell.accessoryView = [[UIImageView alloc]initWithImage:[UIImage imageNamed:@"huicellacce"]];  

  cell.backgroundColor = [UIColor clearColor];

          //cell.selected = YES;

       UIImageView *imageViewSepE = [[UIImageView alloc]initWithFrame:CGRectMake(47, 49, 200, 1)];

    imageViewSepE.image  = [UIImage imageNamed:@"godline"];

          [cell.contentView addSubview:imageViewSepE];

   }

   return cell;

  }

 
  b、比较复杂,用到了底层的框架

p.p1 { margin: 0.0px 0.0px 0.0px 0.0px; font: 18.0px Menlo; color: #000000 }
p.p2 { margin: 0.0px 0.0px 0.0px 0.0px; font: 18.0px Menlo; color: #3e1e81 }
span.s1 { }
span.s2 { color: #c42275 }
span.s3 { color: #703daa }
span.s4 { color: #000000 }
span.s5 { color: #6122ae }
span.s6 { color: #3e1e81 }
span.s7 { color: #0435ff }
span.s8 { color: #1e9421 }
span.s9 { font: 18.0px "PingFang SC"; color: #1e9421 }

  - (void)drawRect:(CGRect)rect {

   CGContextRef context = UIGraphicsGetCurrentContext();

   CGContextSetFillColorWithColor(context, [UIColor clearColor].CGColor); CGContextFillRect(context, rect);

   CGContextSetStrokeColorWithColor(context, [UIColor blackColor].CGColor);

   CGContextStrokeRect(context, CGRectMake(5, -1, rect.size.width - 10, 1)); //下分割线

   CGContextSetStrokeColorWithColor(context, [UIColor blueColor].CGColor);

   CGContextStrokeRect(context, CGRectMake(5, rect.size.height, rect.size.width - 10,1));

  }

 
 
第五条: 用代码的方式自定制cell,必须写initWithStyle的方法
- (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString*)reuseIdentifier{
   
  self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
     if (self) {          
    /*** 这里写要添加控件   ***/
     }   
  return self;
}
 
 
 【iOS开发TableView】TabelView自定义cell
 
第一种:通过创建xib文件。
 
①首先创建xib文件
 
②创建xib文件对应 的模型A,名字与xib文件一样,并继承UITableViewCell类,并实现cellWithTableView的构造方法。
 
③在interface builder里更改xib文件默认的类,为第二步创建的模型类。
 
④创建数据模型B,并且A中包含数据模型B
 
⑤A通过懒加载B方法(就是重写B对象的setter方法)将控件赋值。
 
 
 
第二种:代码自定义cell
 
①新建一个继承UITableViewCell的类,里面拥有frame模型
 
②重写initWithStyle:reuseIdentifier:方法(添加所有需要显示的子控件(不需要设置子控件的数据和frame,  子控件要添加到contentView中,还有添加属性设置).
 
③建立数据模型
 
④建立frame模型(拥有数据模型)
 
⑤重写数据模型对象的setter方法,然后再里面设置控件大小,和cell的高度。
 
⑥控制器拥有frame对象数组。出事Cell的时候直接赋值给cell.frame对象就行。
 
 
第六条:iOS开发 - 让tableView不能下拉刷新,可以上拉加载
1. 首先遵循代理  UIScrollViewDelegate
2.实现代理方法即可
-(void)scrollViewDidScroll:(UIScrollView
*)scrollView{
    if (tabelView.contentOffset.y <= 0) {
        tabelView.bounces = NO;
    }else {
        tabelView.bounces = YES;
    }
}
 
第七条:去除UITableView底部多余行及分割线
self.tableView.tableFooterView = [[UIView alloc] initWithFrame:CGRectZero];
 

iOS开发,UITableView相关问题的更多相关文章

  1. iOS 开发,相关网址

    iOS 开发,相关网址 说明 网址 注册开发者 https://developer.apple.com/cn/programs/enroll/ 未付费688个人开发账号真机调试测试教程 http:// ...

  2. iOS开发UITableView基本使用方法总结

    本文为大家呈现了iOS开发中UITableView基本使用方法总结.首先,Controller需要实现两个delegate ,分别是UITableViewDelegate 和UITableViewDa ...

  3. iOS开发UITableView基本使用方法总结 分类: ios技术 2015-04-03 17:51 68人阅读 评论(0) 收藏

    本文为大家呈现了iOS开发中UITableView基本使用方法总结.首先,Controller需要实现两个delegate ,分别是UITableViewDelegate 和UITableViewDa ...

  4. iOS:UITableView相关(18-10-20更)

    UITableView用得较多,遇到的情况也较多,单独记录一篇. 一.零散的技巧 二.取cell 三.cell高度 四.导航栏.TableView常见问题相关 五.自定义左滑删除按钮图片 六.仅做了解 ...

  5. iOS开发其他相关

    1.iOS开发行情 1.1 iOS系统各个版本的占比查询 2.Xcode的使用 开发软件下载 Xcode Help(官方) 2.1 Xcode面板 Xcode面板 2.2 Xcode版本新功能 Xco ...

  6. iOS开发传感器相关

    手机里面内置了很多的传感器,例如:光传感器,湿度传感器,温度传感器,距离传感器等等 //开发传感器相关的东西必须使用真机 //在螺旋仪和加速计所有两种方式push和pull的方式,push的方式是时时 ...

  7. iOS开发-UITableView自定义Cell

    UITableView在iOS中开发的重要地位是毋庸置疑的,基本上应用中用到的比例是一半左右,而且大部分情况都是需要自定义单元格的,这样用户看到的App才能更有美感.之前写过UITableView的基 ...

  8. iOS开发 UITableView之cell

    1.cell简介 UITableView的每一行都是一个UITableViewCell,通过dataSource的tableView:cellForRowAtIndexPath:方法来初始化每一行 U ...

  9. iOS开发-UITableView表格优化

    之前的一篇文章大概讲述了一下UITableView的使用,UITableView在iOS的地位和ListView在Android中的地位基本上算是不相上下,关于ListView的优化网上的也有很多文章 ...

随机推荐

  1. CentOS7.2 初始化

    ##安装wget,linux默认最小版本不会安装wget yum -y install wget ##安装文件上传下载到服务器的小工具 yum -y install lrzsz ##安装网络工具包 y ...

  2. 高可用系列之Nginx

    1.1Keepalived高可用软件 Keepalived起初是专为LVS设计的,专门用来监控LVS集群系统中各个服务节点的状态,后来又加入了VRRP的功能,因此除了配合LVS服务外,也可以作为其他服 ...

  3. 性能调优之SQL优化

    poptest是国内唯一一家培养测试开发工程师的培训机构,以学员能胜任自动化测试,性能测试,测试工具开发等工作为目标.如果对课程感兴趣,请大家咨询qq:908821478,咨询电话010-845052 ...

  4. BootstrapBootbox居中

    /* 模态框居中样式 */ .bootbox-container { position: fixed; ; ; ; ; ; overflow-y: auto; } .bootbox-container ...

  5. CF #401 (Div. 2) C.Alyona and Spreadsheet (思维)

    题意:给你n行m列的数组,和k次的询问,问从l行到r行是否存在一个非递增的列 思路:看到这道题的数据量我们就知道直接暴力不可取,所以我们采用了预处理的方法,我们记录下来每一行的最长的非递减的列的开头的 ...

  6. mysql5.7.1.3 安装说明 和出现的问题

    1.可以去官网下载 http://dev.mysql.com/downloads/mysql/ 链接: http://pan.baidu.com/s/1hsO5OX2 密码: jmc6 2.解压到文件 ...

  7. ios app网址说明

    URLforBrowser = 'https://itunes.apple.com/cn/app/wan-huo-shi-shang-zhu-li-ren/id1077705***'; URLfori ...

  8. c++:自己动手实现线程安全的c++单例类

    前段时间使用c++做项目开发,需要根据根据配置文件路径加载全局配置文件,并对外提供唯一访问点.面对这样一个需求,自然的就想到了使用单例模式来创建一个单例配置对象,供外部调用.一开始想使用boost中自 ...

  9. 图文详解如何快捷搭建LNMP服务环境

    上一篇与大家一起学习了下如何搭建LAMP环境的知识,今天小编再和大家分享下如何快捷地搭建LNMP环境,并搭建起一个网站.Nginx是一个高性能的HTTP和反向代理服务器,也是一个IMAP/POP3/S ...

  10. error C2664: “UINT GetDriveTypeW(LPCWSTR)”: 无法将参数 1 从“char [5]”转换为“LPCWSTR”

    解决方法:右击项目选择属性--->配置属性--->常规,将字符集改为“使用多字节字符符集”,应用确定即可. 来自为知笔记(Wiz)