UITableView設置Section間距


//section頭部間距
- (CGFloat)tableView:(UITableView )tableView heightForHeaderInSection:(NSInteger)section
{
return 1;//section頭部高度
}
//section頭部視圖
- (UIView
)tableView:(UITableView )tableView viewForHeaderInSection:(NSInteger)section
{
UIView
view=[[UIView alloc] initWithFrame:CGRectMake(0, 0, 320, 1)];
view.backgroundColor = [UIColor clearColor];
return view ;
}
//section底部間距
- (CGFloat)tableView:(UITableView )tableView heightForFooterInSection:(NSInteger)section
{
return 1;
}
//section底部視圖
- (UIView
)tableView:(UITableView )tableView viewForFooterInSection:(NSInteger)section
{
UIView
view=[[UIView alloc] initWithFrame:CGRectMake(0, 0, 320, 1)];
view.backgroundColor = [UIColor clearColor];
return view;
}

文/代碼干貨(簡書作者)
原文鏈接:http://www.jianshu.com/p/7364a11e1fc2
著作權歸作者所有,轉載請聯系作者獲得授權,並標注“簡書作者”。


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM