1. 設(shè)置TableView Separatorinset 分割線從邊框頂端開始
//- (void)layoutSubviews
- (void)viewDidLayoutSubviews
{
//[super layoutSubviews];
[super viewDidLayoutSubviews];
if ([self.tableView respondsToSelector:@selector(setSeparatorInset:)]) {
[self.tableView setSeparatorInset:UIEdgeInsetsMake(0, 0, 0, 0)];
}
if ([self.tableView respondsToSelector:@selector(setLayoutMargins:)]) {
[self.tableView setLayoutMargins:UIEdgeInsetsMake(0, 0, 0, 0)];
}
}
- (void)tableView:(UITableView *)tableView willDisplayCell:(UITableViewCell *)cell forRowAtIndexPath:(NSIndexPath *)indexPat
{
if ([cell respondsToSelector:@selector(setLayoutMargins:)]) {
[cell setLayoutMargins:UIEdgeInsetsMake(0, 0, 0, 0)];
}
if ([cell respondsToSelector:@selector(setSeparatorInset:)]){
[cell setSeparatorInset:UIEdgeInsetsMake(0, 0, 0, 0)];
}
}
2. tableView滾動到底部痊焊,及是否有動畫效果
- (void)tableViewScrollToBottomWithAnimation:(BOOL)animation
{
NSUInteger section = 0;
if (self.tableView.dataSource && [self.tableView.dataSource respondsToSelector:@selector(numberOfSectionsInTableView:)]) {
section = [self.tableView.dataSource numberOfSectionsInTableView:self] - 1;
}
if ([self.tableView.dataSource respondsToSelector:@selector(tableView:numberOfRowsInSection:)]) {
NSUInteger row = [self.tableView.dataSource tableView:self numberOfRowsInSection:section];
if (row > 0) {
[self scrollToRowAtIndexPath:[NSIndexPath indexPathForRow:row - 1 inSection:section] atScrollPosition:UITableViewScrollPositionBottom animated:animation];
// [self scrollRectToVisible:CGRectMake(0, self.tableView.contentSize.height - self.tableView.height, self.tableView.width, self.tableView.height) animated:animation];
}
}
}
最后編輯于 :
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請聯(lián)系作者