源码网商城,靠谱的源码在线交易网站 我的订单 购物车 帮助

源码网商城

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

  • 时间:2022-10-27 21:36 编辑: 来源: 阅读:
  • 扫一扫,手机访问
摘要:iOS程序开发中设置UITableView的全屏分隔线的方法(不画线)
ableView是app开发中常用到的控件,功能很强大,多用于数据的显示。下面给大家介绍设置UITableView的全屏分隔线的两种方法。 具体详情如下所示: [img]http://files.jb51.net/file_images/article/201604/2016041310455335.png[/img] [img]http://files.jb51.net/file_images/article/201604/2016041310455336.png[/img] 如图 添加如下代码
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];
}
}
[img]http://files.jb51.net/file_images/article/201604/2016041310455337.png[/img]
  • 全部评论(0)
联系客服
客服电话:
400-000-3129
微信版

扫一扫进微信版
返回顶部