Swift - UITableView里的cell底部分割线左侧靠边
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底部分割线左侧靠边的更多相关文章
- xib连线出错,模型保存cell状态(最后个Cell隐藏分割线),
一个.m文件中有好几个cell类,拖线,要看看该控件对应的是哪个类,否则点击事件不响应,因为归属的xib错了 拖不过来线,因为是view拖不动,加了个button就行了 使用模型属性记录是否隐藏c ...
- Swift - 实现点击cell动态修改高度
Swift - 实现点击cell动态修改高度 效果 源码 https://github.com/YouXianMing/Swift-Animations // // TapCellAnimationC ...
- SWIFT UITableView的基本用法
import UIKit @UIApplicationMain class AppDelegate: UIResponder, UIApplicationDelegate { var window: ...
- Swift - UITableView状态切换效果
Swift - UITableView状态切换效果 效果 源码 https://github.com/YouXianMing/Swift-Animations // // TableViewTapAn ...
- UITableView中复用cell显示信息错乱
UITableView继承自UIScrollview,是苹果为我们封装好的一个基于scroll的控件.上面主要是一个个的 UITableViewCell,可以让UITableViewCell响应一些点 ...
- Swift - UITableView展开缩放动画
Swift - UITableView展开缩放动画 效果 源码 https://github.com/YouXianMing/Swift-Animations // // HeaderViewTapA ...
- iOS之UITableView中的cell因为重用机制导致新的cell的数据出现重复或者错乱
UITableView中的cell可以有很多,一般会通过重用cell来达到节省内存的目的:通过为每个cell指定一个重用标识符(reuseIdentifier),即指定了单元格的种类,当cell滚 ...
- iOS中UITableView分割线左侧顶齐
iOS 7开始UITableView的分割线不在从左侧边界开始了,而是默认空出了一段距离. 如果想要使用默认的分割线而且还要从左侧边界开始的话,有几种解决方式: 1.在tableView的代理方法中设 ...
- iOS UITableView中关于cell里的按钮被点击时如何确定是哪一个section
在section=10:row=1:的UITableView中,每一个cell都带有一个按钮,例如如下的图片一样每一个cell中都有一个“进入店铺的按钮”,但是如果我点击相应的cell要进入对应的店铺 ...
随机推荐
- Maven使用archetype迅速生成项目骨架
archetype意思是"原型",相当于项目模板.archetype是maven的一个插件,相当于模板工具包. 一个十分重要的mvn指令:mvn 插件名:目标名maven自带三个内 ...
- ionic蓝牙用法
插件cordova官网cordova-plugin-ble-central 1.开启本机蓝牙 ble.enable( function() { console.log("Bluetooth ...
- qq菜单的折叠与展示
敲出每个小例子是一种进步 html结构: <body> <ul id="list"> <li class="lis"> &l ...
- Redis 学习(二)
Redis可以存储以下5种数据类型 1. String 字符串 整数 浮点 2. List 一个链表 3. Set 无序收集器 4. Hash 无序散列表 5. Zset 有序集合
- php实现转换html格式为文本格式的方法
有时候需要转换html格式的字符串为文本,但又需要保持一定的格式,比如要求段落变成的分段格式就可以用下面这个函数 function html2text($str){ $str = preg_repl ...
- C#+ AE 注意问题汇总(不断更新)
1.AE的COM对象释放问题尤其是IFeatureCursor 建议用 ESRI.ArcGIS.ADF.ComReleaser.ReleaseCOMObject(pObj); 或者 int iRefs ...
- [Unity] Shader - CG语言 和 HLSL语言
CG 跟 HLSL几乎是一摸一样的. (HLSL官方参考,包含语法格式,函数库,关键字,在这个地方: http://msdn.microsoft.com/en-us/library/bb509638( ...
- HBase中批量修改
先随便写写..做个随笔记录 使用Rest连接操作Hbase.. 是微软提供的 Microsoft.Hbase.Client 类库.. 版本是0.4.1.0 一直知道 client.StoreCe ...
- golang笔记——并发
go语言中的main函数也是运行在一个单独的goroutine中的,一般称为 main goroutine,main函数结束时,会打断其它 goroutine 的执行,但是其它 goroutine 不 ...
- UVALive 3644 X-Plosives
X-Plosives Time Limit: 3000MS Memory Limit: Unknown 64bit IO Format: %lld & %llu [Submit] ...