uitableview是app开发中常用到的控件,功能很强大,多用于数据的显示。下面给大家介绍设置uitableview的全屏分隔线的两种方法。
具体详情如下所示:
如图 添加如下代码
1
2
3
|
stableview.separatorinset = uiedgeinsetszero; stableview.layoutmargins = uiedgeinsetszero; cell.layoutmargins = uiedgeinsetszero; |
第二种方法如下图
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
|
-( 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]; } } |