cell separator line 不能到头
2015-11-10 18:00
274 查看
//Setup your cell margins:
-(void)tableView:(UITableView *)tableView willDisplayCell:(UITableViewCell *)cell
forRowAtIndexPath:(NSIndexPath *)indexPath {
// Remove seperator inset
if ([cell
respondsToSelector:@selector(setSeparatorInset:)]) {
[cell setSeparatorInset:UIEdgeInsetsZero];
}
// Prevent the cell from inheriting the Table View's margin settings
if ([cell
respondsToSelector:@selector(setPreservesSuperviewLayoutMargins:)]) {
[cell setPreservesSuperviewLayoutMargins:NO];
}
// Explictly set your cell's layout margins
if ([cell
respondsToSelector:@selector(setLayoutMargins:)]) {
[cell setLayoutMargins:UIEdgeInsetsZero];
}
if([tableView
respondsToSelector:@selector(setCellLayoutMarginsFollowReadableWidth:)])
{
tableView.cellLayoutMarginsFollowReadableWidth =
NO;
}
}
#pragma //correct iOS9 the cell separator line not to left
-(void)viewDidLayoutSubviews
{
[super
viewDidLayoutSubviews];
// Force your tableview margins (this may be a bad idea)
if ([self.tableView
respondsToSelector:@selector(setSeparatorInset:)]) {
[self.tableView
setSeparatorInset:UIEdgeInsetsZero];
}
if ([self.tableView
respondsToSelector:@selector(setLayoutMargins:)]) {
[self.tableView
setLayoutMargins:UIEdgeInsetsZero];
}
if([self.tableView
respondsToSelector:@selector(setCellLayoutMarginsFollowReadableWidth:)])
{
self.tableView.cellLayoutMarginsFollowReadableWidth =
NO;
}
}
-(void)tableView:(UITableView *)tableView willDisplayCell:(UITableViewCell *)cell
forRowAtIndexPath:(NSIndexPath *)indexPath {
// Remove seperator inset
if ([cell
respondsToSelector:@selector(setSeparatorInset:)]) {
[cell setSeparatorInset:UIEdgeInsetsZero];
}
// Prevent the cell from inheriting the Table View's margin settings
if ([cell
respondsToSelector:@selector(setPreservesSuperviewLayoutMargins:)]) {
[cell setPreservesSuperviewLayoutMargins:NO];
}
// Explictly set your cell's layout margins
if ([cell
respondsToSelector:@selector(setLayoutMargins:)]) {
[cell setLayoutMargins:UIEdgeInsetsZero];
}
if([tableView
respondsToSelector:@selector(setCellLayoutMarginsFollowReadableWidth:)])
{
tableView.cellLayoutMarginsFollowReadableWidth =
NO;
}
}
#pragma //correct iOS9 the cell separator line not to left
-(void)viewDidLayoutSubviews
{
[super
viewDidLayoutSubviews];
// Force your tableview margins (this may be a bad idea)
if ([self.tableView
respondsToSelector:@selector(setSeparatorInset:)]) {
[self.tableView
setSeparatorInset:UIEdgeInsetsZero];
}
if ([self.tableView
respondsToSelector:@selector(setLayoutMargins:)]) {
[self.tableView
setLayoutMargins:UIEdgeInsetsZero];
}
if([self.tableView
respondsToSelector:@selector(setCellLayoutMarginsFollowReadableWidth:)])
{
self.tableView.cellLayoutMarginsFollowReadableWidth =
NO;
}
}
相关文章推荐
- JAVA打印正弦图形
- iOS Project和target
- QTime获取当前时间,QDateTime获取日期和时间,QTimer定时器,QLCDNumber数码显示框
- expire_logs_day binlog自动过期清理binlog
- linux shell 正则表达式(BREs,EREs,PREs)差异比较
- [LeetCode]题解(python):050-Pow(x, n)
- 如何成为微信公众平台开发者
- AJax
- 最新
- 正则表达式30分钟入门教程
- 文件过滤驱动中 IRP_MJ_XX_INFORMATION 查询文件对象是文件还是目录的方法
- Java并发编程(六) 一个日志服务的例子
- __construct __destory __call __get __set
- Div的移动
- JS异步代码执行和同步代码之间的关系
- Java RC4 加密解密
- 第23讲 项目5:我的加班费
- ROM、RAM、闪存
- Mybatis3.x与Spring4.x整合
- 05-工具箱