第一条: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. ng指令控制一个元素的影藏的与显示几种方法的使用

    在ng中我们控制一个元素的显示与隐藏的方法: (1):ng-show=true/false 解释:ng-show使用的是display="block"/"none&quo ...

  2. Learning to Rank简介

    Learning to Rank是采用机器学习算法,通过训练模型来解决排序问题,在Information Retrieval,Natural Language Processing,Data Mini ...

  3. Android批量验证渠道、版本号

    功能:可校验单个或目录下所有apk文件的渠道号.版本号使用说明:1.copy需要校验的apk文件到VerifyChannelVersion目录下2.双击运行VerifyChannelVersion.b ...

  4. Python学习_ConfigParse (转)

    1.基本的读取配置文件   -read(filename) 直接读取ini文件内容 -sections() 得到所有的section,并以列表的形式返回 -options(section) 得到该se ...

  5. 现代3D图形编程学习--opengl使用不同的缓存对象(译者添加)

    现代3D图形编程学习系列翻译地址 http://www.cnblogs.com/grass-and-moon/category/920962.html opengl使用不同的缓存对象 在设置颜色一章中 ...

  6. 转载---关于Spring的69个面试问答

    链接:http://www.importnew.com/11657.html 目录 Spring概述 依赖注入 Spring Beans Spring注解 Spring的对象访问 Spring面向切面 ...

  7. 关于string类型定义占几个字节??

    测试代码: #include <iostream>using namespace std;int main(void){ string name; cout<<"si ...

  8. 关于css禁止文本复制属性

    最近在做DHTMLX框架替换,新框架dhx的grid是不能选中内容复制的 虽然相对来说是安全些的,但是客户体验度一定会大打折扣 网页上禁止复制主要靠JavaScript来实现.<BODY onc ...

  9. Css清除浮动最优方式之一

    ---恢复内容开始--- .container:before, .container:after { display: table; content: " "; } .contai ...

  10. cocos2d-x-Json/XML文件

    数据存储几种方式 1. 数据库 2. 文件 3. 内存 这里介绍Json格式与XML格式的文件存储 常用的文件存储数据的格式 1. Json格式 2. XML格式 Json适合存储小数据,XML适合存 ...