去除TableView的边框线. (分割线 ,下划线就这个意思)
2015-08-19 17:30
423 查看
一,
UITableViewStylePlain类型的UITableView去除边框线有直接的属性方法:
separatorStyle = UITableViewCellSeparatorStyleNone;
但在UITableViewStyleGrouped类型的UITableView中,该方法无效!
如何去除边框线呢?答案很简单:
separatorColor=[UIColor clearColor];
二,
在UITableViewStyleGrouped这个类型下, tableView会有一个高度是35的组间距,也就是viewForHeader中的view的高度.重新设置一下这个view就好了.
- (CGFloat)tableView:(UITableView *)tableView
heightForHeaderInSection:(NSInteger)section
{
return 1;
}
- (CGFloat)tableView:(UITableView *)tableView
heightForFooterInSection:(NSInteger)section
{
return 1;
}
-(UIView *)tableView:(UITableView *)tableView
viewForHeaderInSection:(NSInteger)section
{
UIView * view = [[UIView alloc]initWithFrame:CGRectMake(0, 0, 320, 1)];
view.backgroundColor = [UIColor clearColor];
return view;
}
- (UIView *)tableView:(UITableView *)tableView
viewForFooterInSection:(NSInteger)section
{
UIView * view = [[UIView alloc]initWithFrame:CGRectMake(0, 0, 320, 1)];
view.backgroundColor = [UIColor clearColor];
return view;
}
UITableViewStylePlain类型的UITableView去除边框线有直接的属性方法:
separatorStyle = UITableViewCellSeparatorStyleNone;
但在UITableViewStyleGrouped类型的UITableView中,该方法无效!
如何去除边框线呢?答案很简单:
separatorColor=[UIColor clearColor];
二,
在UITableViewStyleGrouped这个类型下, tableView会有一个高度是35的组间距,也就是viewForHeader中的view的高度.重新设置一下这个view就好了.
- (CGFloat)tableView:(UITableView *)tableView
heightForHeaderInSection:(NSInteger)section
{
return 1;
}
- (CGFloat)tableView:(UITableView *)tableView
heightForFooterInSection:(NSInteger)section
{
return 1;
}
-(UIView *)tableView:(UITableView *)tableView
viewForHeaderInSection:(NSInteger)section
{
UIView * view = [[UIView alloc]initWithFrame:CGRectMake(0, 0, 320, 1)];
view.backgroundColor = [UIColor clearColor];
return view;
}
- (UIView *)tableView:(UITableView *)tableView
viewForFooterInSection:(NSInteger)section
{
UIView * view = [[UIView alloc]initWithFrame:CGRectMake(0, 0, 320, 1)];
view.backgroundColor = [UIColor clearColor];
return view;
}
相关文章推荐
- android 代码实现控件之间的间距
- android给listview设置分割线Divider样式
- 阿里巴巴2015校园招聘前端在线笔试题
- iOS7的Cell的分割线宽度不满屏,解决方法
- UITableViewCell的选中时的颜色设置和分割线颜色设置
- 自定义cell分割线
- UITableview cell之间间距设置
- listview分割线设置两边不贴边
- 设置自定义UITableViewCell之间的间距
- TableViewCell分割线的设置
- UITableView的一些细节技巧
- android 画分割线
- 如何清除LI之间的间距
- 隐藏UITableView多余的分割线
- 隐藏UITableView多余的分割线
- 隐藏UITableView多余的分割线
- 隐藏UITableView多余的分割线
- 隐藏UITableView多余的分割线
- 隐藏UITableView多余的分割线
- 隐藏UITableView多余的分割线