UITableView分割线从边框顶端开始
2016-03-23 10:51
344 查看
在ios8上
[TableView setSeparatorInset:UIEdgeInsetsMake(0,0,0,0)];不起作用
经过测试加入下面方法
在ios7 8上都可以正常工作
在初始化tableView时
if ([self.tableView respondsToSelector:@selector(setSeparatorInset:)]) {
[self.tableView setSeparatorInset:UIEdgeInsetsZero];
if ([self.tableView respondsToSelector:@selector(setLayoutMargins:)]) {
[self.tableView setLayoutMargins:UIEdgeInsetsZero];
}
}
在初始化cell时加上
if ([cell respondsToSelector:@selector(setSeparatorInset:)]) {
[cell setSeparatorInset:UIEdgeInsetsZero];
}
if ([cell respondsToSelector:@selector(setLayoutMargins:)]) {
[cell setLayoutMargins:UIEdgeInsetsZero];
}
这个可以放在自定义cell时 写上
还可以在tableViewDelegate方法
- (void) tableView:(UITableView*)tableView willDisplayCell:(UITableViewCell*)cell forRowAtIndexPath:(NSIndextPath*)indexPath
里改
[TableView setSeparatorInset:UIEdgeInsetsMake(0,0,0,0)];不起作用
经过测试加入下面方法
在ios7 8上都可以正常工作
在初始化tableView时
if ([self.tableView respondsToSelector:@selector(setSeparatorInset:)]) {
[self.tableView setSeparatorInset:UIEdgeInsetsZero];
if ([self.tableView respondsToSelector:@selector(setLayoutMargins:)]) {
[self.tableView setLayoutMargins:UIEdgeInsetsZero];
}
}
在初始化cell时加上
if ([cell respondsToSelector:@selector(setSeparatorInset:)]) {
[cell setSeparatorInset:UIEdgeInsetsZero];
}
if ([cell respondsToSelector:@selector(setLayoutMargins:)]) {
[cell setLayoutMargins:UIEdgeInsetsZero];
}
这个可以放在自定义cell时 写上
还可以在tableViewDelegate方法
- (void) tableView:(UITableView*)tableView willDisplayCell:(UITableViewCell*)cell forRowAtIndexPath:(NSIndextPath*)indexPath
里改
相关文章推荐
- Android Activity.runOnUiThread() 和 Handler
- 【学渣笔记】Xitrum Scala Web Framework Guide
- iOS UITableCell复用
- UIImageView的ContentMode属性
- Process 'command '**/ndk-build.cmd'' finished with non-zero exit value 1
- UIView的layoutSubviews和drawRect
- (转)Storm UI 解释
- marquee标签弹幕效果
- iOS-添加UINavigation
- dispatchTouchEvent
- QtQuick项目部署
- Java中Integer的valueOf方法,-128到127的整数将被缓存
- 使用fuel部署openstack时遇到的问题记录一下
- Java序列化之transient和serialVersionUID的使用
- UI元素状态伪类选择器
- 转 String,StringBuffer与StringBuilder的区别??
- Query 提交按钮置灰与恢复
- 小米手机 更新系统之后(MIUI 7.2稳定版) 拍照上传返回 取不到数据问题!
- PDE14 heat equation intuition
- Could not complete request java.lang.NullPointerException