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要进入对应的店铺 ...
随机推荐
- 使用CocoaPods开发并打包静态库
Cocoapods作为OS X和iOS开发平台的类库管理工具,已经非常完善和强大.通常我们用pod来管理第三方开源类库,但我们也极有可能会开发一个用pod管理依赖关系的静态类库给其他人使用,而又不愿意 ...
- CodeForces 548D 单调栈
Mike and Feet Time Limit:1000MS Memory Limit:262144KB 64bit IO Format:%I64d & %I64u Subm ...
- MinGW安装c-c++
1.安装环境 2.添加环境变量 3.运行终端
- telnet建立http连接获取网页HTML内容
利用telnet可以与服务器建立http连接,获取网页,实现浏览器的功能.它对于需要对http header进行观察和测试到时候非常方便.因为浏览器看不到http header. 步骤如下: 1. 运 ...
- Ubuntu16.04编译Android6.0/cm13.0教程及相关错误解决办法
一.必备工作 1.安装依赖库 sudo apt--dev libesd0-dev git-core gnupg flex bison gperf build-essential zip curl zl ...
- Linux 查找进程运行位置
1.通过ps或者top命令查看运行的进程的pid ps -aux|grep php-fpm #或者 top 2. 获取进程的pid后,然后使用命令ls -l /proc/${pid},这个命令可以列出 ...
- System类和Random类
System类 成员方法: public static void gc():运行垃圾回收器 public static void exit(int status):退出垃圾回收器 public sta ...
- debian 缺少固件怎么解决
一般是安装的时候会遇到这个问题.http://www.debian.org/releases/stable/amd64/ch02s02.html.en 解决办法是先下载对应debian版本的firmw ...
- python gutter area / 设置断点、行号右边代码左边的空白栏
最后通过在设置里搜索 关键词:show 找到的.== Edito > General > Gutter Icons Show gutter icons
- php函数fgets读取文件
如果一个文件比较大,可以考虑用fgets函数 下面是个例子: #文件作用:fgets读取文件 $start_time = microtime(true); $file_name = "a.t ...