iOS-UITableView 设置分割线长度和颜色
2016-04-21 13:55
447 查看
本文首发地址
网上了看了好多方法去掉UITableview的分割线以及设置分割线颜色的方法,大多都是在iOS7以后的方法。
今天给大家来一个多功能全方位的设置的装逼技能
废话不多说,上代码在ios7以前的代码
// 设置距离左右各10的距离 - (void)tableView:(UITableView *)tableView willDisplayCell:(UITableViewCell *)cell forRowAtIndexPath:(NSIndexPath *)indexPath{ if ([cell respondsToSelector:@selector(setSeparatorInset:)]) { [self.myTable setSeparatorInset:UIEdgeInsetsMake(0, 10, 0, 10)]; } if ([cell respondsToSelector:@selector(setLayoutMargins:)]) { [cell setLayoutMargins:UIEdgeInsetsZero]; } } - (void)viewDidLayoutSubviews{ [super viewDidLayoutSubviews]; if ([self.myTable respondsToSelector:@selector(setSeparatorInset:)]) { [self.myTable setSeparatorInset:UIEdgeInsetsMake(0, 10, 0, 10)]; } if ([self.myTable respondsToSelector:@selector(setLayoutMargins:)]) { [self.myTable setLayoutMargins:UIEdgeInsetsZero]; } }
在ios7以后的代码
TableView.separatorInset=UIEdgeInsetsMake(0,10, 0, 10); //top left bottom right 左右边距相同 TableView.separatorStyle=UITableViewCellSeparatorStyleSingleLine
相关文章推荐
- POJ 2299 Ultra-QuickSort 树状数组
- java web笔记——request&response
- [IOS 开发] NSOperationQueue常用方法
- Android学习笔记(40):SharedPreferences存储key-value对
- Android UI基础——ListView控件及Adapter适配器
- GradleUserGuide中文版 1)介绍 2)概述 3)教程 4)安装 5)故障 6)构建基础
- FZU 1894 志愿者选拔【单调队列】【monotone decreasing queue】
- [BS-03] 统一设置UITabBarController管理的所有VC的tabBarItem图标文字的颜色大小等属性
- UIImageView 点击放大缩小
- HDU 2604 Queuing(矩阵快速幂)
- HDU 2604 Queuing(矩阵快速幂)
- [置顶] UI设计资源收集
- 万恶的开源druid,去die
- Errors occurred during the build Errors running builder
- Android uiautomator 使用入门官方教程
- 算法Sedgewick第四版-第1章基础-1.3Bags, Queues, and Stacks-001可变在小的
- 触摸事件 - UIControlEvents
- VS 2008 Setup Project Build 出现 ERROR: Could not create the file,发现是Chrome 启服务Software Protection的导致。
- 关于fuel8的处理
- ant build基本概念