栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 软件开发 > 移动开发 > iOS

iOS程序开发中设置UITableView的全屏分隔线的方法(不画线)

iOS 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

iOS程序开发中设置UITableView的全屏分隔线的方法(不画线)

ableView是app开发中常用到的控件,功能很强大,多用于数据的显示。下面给大家介绍设置UITableView的全屏分隔线的两种方法。

具体详情如下所示:

如图 添加如下代码

sTableView.separatorInset = UIEdgeInsetsZero;
sTableView.layoutMargins = UIEdgeInsetsZero;
cell.layoutMargins = UIEdgeInsetsZero;

第二种方法如下图

-(void)viewDidLayoutSubviews
{
[super viewDidLayoutSubviews];
if ([_moreTableView respondsToSelector:@selector(setSeparatorInset:)]) {
[_moreTableView setSeparatorInset:UIEdgeInsetsMake(0,0,0,0)];
}
if ([_moreTableView respondsToSelector:@selector(setLayoutMargins:)]) {
[_moreTableView setLayoutMargins:UIEdgeInsetsMake(0,0,0,0)];
}
}
-(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];
}
}

转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/167393.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号