override func viewDidLoad() {

super.viewDidLoad()

// Do any additional setup after loading the view, typically from a nib.

// tableview顶部空白

self.automaticallyAdjustsScrollViewInsets = false

tableView = UITableView(frame: CGRectMake(10, 64, UIScreen.mainScreen().bounds.width - 20, 200), style: .Grouped)

tableView.delegate = self

tableView.dataSource = self

tableView.scrollEnabled = false

//        tableView.separatorStyle = .None

// tableview设置边框

// 设置边框的宽度

tableView.layer.borderWidth = 1

// 设置边框的颜色

tableView.layer.borderColor = UIColor.whiteColor().CGColor

// 设置UIView的边框为圆角和展现

tableView.layer.cornerRadius = 10

tableView.layer.masksToBounds = true

// 底部分割线左对齐

tableView.separatorInset = UIEdgeInsetsZero

tableView.layoutMargins = UIEdgeInsetsZero

tableView.cellLayoutMarginsFollowReadableWidth = false

self.view.addSubview(tableView)

}

func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell {

let cell = tableView.dequeueReusableCellWithIdentifier("cell") ?? UITableViewCell(style: .Default, reuseIdentifier: "cell")

cell.separatorInset = UIEdgeInsetsZero

cell.layoutMargins = UIEdgeInsetsZero

cell.preservesSuperviewLayoutMargins = false

return cell

}

PS:有时候只设置tableView和cell的SeparatorInsert和LayoutMargins仍然不能解决这个问题,左边一点距离始终没有办法封闭。
这时需要设置tableView的cellLayoutMarginsFollowReadableWidth,和cell的preservesSuperviewLayoutMargins。

Swift - UITableView里的cell底部分割线左侧靠边的更多相关文章

  1. xib连线出错,模型保存cell状态(最后个Cell隐藏分割线),

    一个.m文件中有好几个cell类,拖线,要看看该控件对应的是哪个类,否则点击事件不响应,因为归属的xib错了 拖不过来线,因为是view拖不动,加了个button就行了   使用模型属性记录是否隐藏c ...

  2. Swift - 实现点击cell动态修改高度

    Swift - 实现点击cell动态修改高度 效果 源码 https://github.com/YouXianMing/Swift-Animations // // TapCellAnimationC ...

  3. SWIFT UITableView的基本用法

    import UIKit @UIApplicationMain class AppDelegate: UIResponder, UIApplicationDelegate { var window: ...

  4. Swift - UITableView状态切换效果

    Swift - UITableView状态切换效果 效果 源码 https://github.com/YouXianMing/Swift-Animations // // TableViewTapAn ...

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

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

  6. Swift - UITableView展开缩放动画

    Swift - UITableView展开缩放动画 效果 源码 https://github.com/YouXianMing/Swift-Animations // // HeaderViewTapA ...

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

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

  8. iOS中UITableView分割线左侧顶齐

    iOS 7开始UITableView的分割线不在从左侧边界开始了,而是默认空出了一段距离. 如果想要使用默认的分割线而且还要从左侧边界开始的话,有几种解决方式: 1.在tableView的代理方法中设 ...

  9. iOS UITableView中关于cell里的按钮被点击时如何确定是哪一个section

    在section=10:row=1:的UITableView中,每一个cell都带有一个按钮,例如如下的图片一样每一个cell中都有一个“进入店铺的按钮”,但是如果我点击相应的cell要进入对应的店铺 ...

随机推荐

  1. 软件工程(FZU2015)赛季得分榜,第一回合

    目录 第一回合 第二回合 第三回合 第四回合 第五回合 第6回合 第7回合 第8回合 第9回合 第10回合 第11回合 积分规则 积分制: 作业为10分制,练习为3分制:alpha30分: 团队项目分 ...

  2. C#接口和抽象类的区别

    大家都容易把这两者搞混,我也一样,在听李建忠老师的设计模式时,他也老把抽象类说成接口,弄的我就更糊涂了,所以找了些网上的资料.      一.抽象类:      抽象类是特殊的类,只是不能被实例化:除 ...

  3. Python笔记(4)类__属性与描述符

    部分参考自:http://www.geekfan.net/7862/ 新式类与经典类 2和3不一样,3都是新式类. 新式类和经典类的区别: class A: #classic class " ...

  4. 教你一招:解决安装或卸载office时 提示错误2503 2502 发生了内部错误

    问题重现: 解决办法:使用软件卸载工具 Uninstall Tool 3.5.1 中文破解版强制删除文件,非常暴力,完美解决. 解决过程一览: 工具下载地址: 软件卸载工具 Uninstall Too ...

  5. 用类(function(){})()实现点击显示index索引值的详解

    code: <script type="text/javascript"> ; i < ; i++){ var btn = document.createElem ...

  6. bzoj 1031 [JSOI2007]字符加密Cipher

    求出来后缀数组的rank就行了,不会可以去看集训队论文. #include<iostream> #include<cstdio> #include<cstring> ...

  7. 分布式服务框架dubbo原理解析(转)

    libaba有好几个分布式框架,主要有:进行远程调用(类似于RMI的这种远程调用)的(dubbo.hsf),jms消息服务(napoli.notify),KV数据库(tair)等.这个框架/工具/产品 ...

  8. 配置samba

    安装samba服务器之后,很方便的实现Windows和Linux进行通信. 安装步骤:1.在Ubuntu系统下面安装samba服务: nii@ww:~$ sudo apt-get install sa ...

  9. HTML5 图片缩放功能

    腾讯新闻上用的插件(xw.qq.com) 缩放插件scale.js (function(window, undefined) { var document = window.document, sup ...

  10. 【原】javascript事件流

    摘要:事件流这个东西是比较重要的,为了让自己更加理解js中的事件流,必须整理整理,梳理一下事件流的各种东西啊.本文大部分内容参考<javascript高级程序设计第三版> 先来一段书里的原 ...