tableViewCell的分割线短一截的问题
2015-08-27 10:18
183 查看
最近在写很简单的tableView的布局时,发现系统自带的Cell分割线短了15像素,不过这个可以更改,纯代码方式如下:
//设置分割线到头,不再断15像素
if ([self.tableView respondsToSelector:@selector(setLayoutMargins:)]) {
[self.tableView setLayoutMargins:UIEdgeInsetsZero];
}
在ios7系统运行上面的就可以搞定,不过ios8 必须加上下面的方法和内容,否则依然短15像素
- (void)tableView:(UITableView *)tableView willDisplayCell:(UITableViewCell *)cell forRowAtIndexPath:(NSIndexPath *)indexPath
{
if ([cell respondsToSelector:@selector(setSeparatorInset:)]) {
[cell setSeparatorInset:UIEdgeInsetsZero];
}
if ([cell respondsToSelector:@selector(setLayoutMargins:)]) {
[cell setLayoutMargins:UIEdgeInsetsZero];
}
}
原文出处:http://blog.csdn.net/lengshengren/article/details/19335637,向作者致敬!
//设置分割线到头,不再断15像素
if ([self.tableView respondsToSelector:@selector(setLayoutMargins:)]) {
[self.tableView setLayoutMargins:UIEdgeInsetsZero];
}
在ios7系统运行上面的就可以搞定,不过ios8 必须加上下面的方法和内容,否则依然短15像素
- (void)tableView:(UITableView *)tableView willDisplayCell:(UITableViewCell *)cell forRowAtIndexPath:(NSIndexPath *)indexPath
{
if ([cell respondsToSelector:@selector(setSeparatorInset:)]) {
[cell setSeparatorInset:UIEdgeInsetsZero];
}
if ([cell respondsToSelector:@selector(setLayoutMargins:)]) {
[cell setLayoutMargins:UIEdgeInsetsZero];
}
}
原文出处:http://blog.csdn.net/lengshengren/article/details/19335637,向作者致敬!
相关文章推荐
- [ios]"The identity used to sign the executable is no longer valid"错误解决方法
- Java常用集合类
- Creating a .bash_profile on your mac
- maven中的继承和聚合的关系
- 8月25日全球域名商(国际域名)解析量排行榜TOP20
- 找零钱的贪心算法
- 服务器预防DDoS攻击的方法
- 服务器预防DDoS攻击的方法
- iOS价格日历
- lua单链表简单实现
- Android存储数据方法——SharedPreferences
- android学习1
- android学习1
- javax.naming.NameNotFoundException
- 83 js 如何正确传递DOM元素的指针 选择器内参数为变量 论js函数的简化 seajs用法
- Hibernate检索方式浅记
- Qt 之 运行Qt Creator出现cannot find -lGL的问题的两种解决
- 为了我那忘却的记忆而做的笔记
- 环信即时通讯 —— IOS客户端集成
- iOS学习 - 应用程序管理