http://blog.csdn.NET/bihailantian1988/article/details/7703322
plain類(lèi)型的tableview當(dāng)顯示的數(shù)據(jù)很少時(shí),下面的cell即使不顯示數(shù)據(jù)也會(huì)有分割線,可以通過(guò)下面這個(gè)函數(shù)去掉多余的分割線。
- (void)setExtraCellLineHidden: (UITableView*)tableView
{
UIView*view =[ [UIViewalloc]init];
view.backgroundColor= [UIColorclearColor];
[tableViewsetTableFooterView:view];
[viewrelease];
}
當(dāng)tableview的dataSource為空時(shí),也就是沒(méi)有數(shù)據(jù)可顯示時(shí),該方法無(wú)效,只能在numberOfRowsInsection函數(shù),通過(guò)判斷dataSouce的數(shù)據(jù)個(gè)數(shù),如果為零可以將tableview的separatorStyle設(shè)置為UITableViewCellSeparatorStyleNone去掉分割線,然后在大于零時(shí)將其設(shè)置為
UITableViewCellSeparatorStyleSingleLine