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];}}
新闻热点
疑难解答