- #pragma mark - **iOS8分割 * **************
- //iOS8 分割线右移15像素 下面将其归零
- //目的是去除没有内容的cell的分割线(适用于没有tableFooterView的tableView)
- tableView.tableFooterView = [[UIView alloc] init];
- // 需要在创建tableView时 加上这两句代码
- if ([self.tableView respondsToSelector: @selector(setSeparatorInset: )]) {
- [self.tableView setSeparatorInset: UIEdgeInsetsZero];
- }
- if ([self.tableView respondsToSelector: @selector(setLayoutMargins: )]) {
- [self.tableView setLayoutMargins: UIEdgeInsetsZero];
- }#pragma mark - iOS8分割线右移15像素下面将其归零 - (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];
- }
- }
来源: http://lib.csdn.net/snippet/ios/42287