解决tableViewCell分割线不到左边界的问题
生活随笔
收集整理的這篇文章主要介紹了
解决tableViewCell分割线不到左边界的问题
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
?
?
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 | 在tableView控制器的.m文件中任何位置加入以下兩個方法即可解決 /** ?*? 下面兩個方法解決cell分割線不到左邊界的問題 ?*/ -(void)viewDidLayoutSubviews { ????? ????if ([self.tableView respondsToSelector:@selector(setSeparatorInset:)]) { ????????[self.tableView setSeparatorInset:UIEdgeInsetsZero]; ????????? ????} ????if ([self.tableView respondsToSelector:@selector(setLayoutMargins:)])? { ????????[self.tableView setLayoutMargins:UIEdgeInsetsZero]; ????} ????? } /** ?* 這個方法和上面一個方法解決cell分割線不到左邊界的問題 ?*/ -(void)tableView:(UITableView *)tableView willDisplayCell:(UITableViewCell *)cell forRowAtIndexPath:(NSIndexPath *)indexPat{ ????if ([cell respondsToSelector:@selector(setLayoutMargins:)]) { ????????[cell setLayoutMargins:UIEdgeInsetsZero]; ????} ????if ([cell respondsToSelector:@selector(setSeparatorInset:)]){ ????????[cell setSeparatorInset:UIEdgeInsetsZero]; ????} } |
轉載于:https://www.cnblogs.com/bugismyalllife/p/4884270.html
總結
以上是生活随笔為你收集整理的解决tableViewCell分割线不到左边界的问题的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: ★★★★★★★★★★★★★★★★★★★★
- 下一篇: servlet中访问mysql无法包含中