具体的效果可以参考微信ios7版的UITableview 它最后一行cell的separator是顶到最左边的

首先设置tableFooterView

  1. _messageTableview.tableFooterView = [[UIView alloc] initWithFrame:CGRectZero];

然后在willDisplayCell上增加如下代码 控制最后一行separatorInset位置

  1. - (void)tableView:(UITableView *)tableView willDisplayCell:(UITableViewCell *)cell forRowAtIndexPath:(NSIndexPath *)indexPath{
  2. NSMutableDictionary *dic = [typeArray objectAtIndex:indexPath.section];
  3. NSMutableDictionary *infoDic = [dic objectForKey:@"dic"];
  4. if (indexPath.row==[infoDic count]-1) {
  5. NSLog(@"indexPath.row===%d",indexPath.row);
  6. cell.separatorInset = UIEdgeInsetsMake(10, 0, 0, 0);
  7. }
  8. }

参考资料:http://stackoverflow.com/questions/12168002/how-to-remove-last-border-of-last-cell-in-uitableview

http://blog.csdn.net/catandrat111/article/details/7794030

http://stackoverflow.com/questions/1369831/eliminate-extra-separators-below-uitableview-in-iphone-sdk/1789714#1789714

http://blog.cnrainbird.com/index.php/2013/10/05/yin_cang_uitableview_xia_bu_xu_yao_de_fen_ge_xian_zhuan/

转载自:http://blog.csdn.net/mideveloper/article/details/20365009

UITableView去除空白cell上多余separator的更多相关文章

  1. StringUtils工具类常用方法汇总2(截取、去除空白、包含、查询索引)

      在上一篇中总结了StringUtils工具类在判断字符串为空,大小写转换,移除字符或字符序列,替换,反转,切割合并等方面的方法,这次再汇总一下其它常用的方法. 一.截取   StringUtils ...

  2. iOS-UITableView-处理cell上按钮事件(弹出警示框,页面跳转等)

    一. 目的: 实现UITableViewCell上按钮点击事件可以进行页面跳转. 二. 实现方法: 1. 用协议的方式的实现. 2. 需要自定义UITableViewCell. 三. 代码部分. ce ...

  3. UITableView中复用cell显示信息错乱

    UITableView继承自UIScrollview,是苹果为我们封装好的一个基于scroll的控件.上面主要是一个个的 UITableViewCell,可以让UITableViewCell响应一些点 ...

  4. StringUtils工具类常用方法汇总(截取、去除空白、包含、查询索引)

    一.截取   StringUtils中常用的截取字符串的方法如下: substring(String str,int start) substring(String str,int start, in ...

  5. UITableView左右滑动cell无法显示“删除”按钮的原因分析

    http://www.cocoachina.com/bbs/read.php?tid-145693.html - (void)tableView:(UITableView *)tableView co ...

  6. iOS之UITableView中的cell因为重用机制导致新的cell的数据出现重复或者错乱

      UITableView中的cell可以有很多,一般会通过重用cell来达到节省内存的目的:通过为每个cell指定一个重用标识符(reuseIdentifier),即指定了单元格的种类,当cell滚 ...

  7. objc_setAssociatedObject获取cell上button对应所在的行

    #import <UIKit/UIKit.h> @interface TestCell : UITableViewCell @property (weak, nonatomic) IBOu ...

  8. 按钮在cell上的高亮状态出现的慢

    在单元格上放一个全屏长的按钮  高度不是cell的高度    当点击cell上的按钮的时候   按钮的高亮状态会出现的比较慢   因为按钮设置的就是touchUpInside   所以当你向下按的时候 ...

  9. 7、8上的cell上的一个按钮,当点击按钮时,要拿到这个cell,可以用代理,也可以用superview

    /** cell上的付款按钮事件 */ - (IBAction)paymentButtonClick:(UIButton *)sender { /** * @author SongXing, 15-0 ...

随机推荐

  1. 源码解读—HashMap

    什么是HashMap ? hashMap是用什么基础数据结构实现的?HashMap是如何解决hashCode冲突的? hashMap的基础容器是数组+链表(transient Entry[] tabl ...

  2. (medium)LeetCode 222.Count Complete Tree Nodes

    Given a complete binary tree, count the number of nodes. Definition of a complete binary tree from W ...

  3. 动画的特效Interpolator

    AccelerateDecelerateInterpolator 在动画开始与结束的地方速率改变比较慢,在中间的时候加速 AccelerateInterpolator  在动画开始的地方速率改变比较慢 ...

  4. python3 pickle, json

    pickle 有dump ,dumps ,load,loads等方法.区别在于dumps不会写入到文件. import pickle string = ['a', 2341, 'adsf'] p_st ...

  5. MapHttpRoute

    http://aspnetwebstack.codeplex.com/SourceControl/latest#src/System.Web.Http/HttpRouteCollectionExten ...

  6. Android——ScrollView

    1.activity_scrollview.xml <?xml version="1.0" encoding="utf-8"?><Scroll ...

  7. UIBlurEffect实现模糊效果

    //使用图片初始化背景 Pattern 图案,模式 self.view.backgroundColor = [UIColor colorWithPatternImage:[UIImage imageN ...

  8. [mysq]ERROR 2006 (HY000) at line xx: MySQL server has gone away 解决方法

    vi /etc/my.cnf wait_timeout=2880000interactive_timeout = 2880000max_allowed_packet = 100M 完整配置文件 [my ...

  9. 学习总结 java 父子级

    package com.hanqi; //父类 public class Father { // public Father() // { // // } // public Father(Strin ...

  10. [前端 1] 使用frameset框架构建网页基本布局

    导读:在做项目的过程中,发现网页的一些地方是不变的,比如说顶部.底部.而变幻的内容就只是一部分.这个时候在想,这是每次都刷新一个界面呢,还是有别的快捷方法呢.然后就找到了frameset 这个东西.本 ...