1. 延長(zhǎng)分割線
- (void)viewDidLayoutSubviews {
if ([self.tableView respondsToSelector:@selector(setSeparatorInset:)]) {
[self.tableView setSeparatorInset:UIEdgeInsetsZero];
}
if ([self.tableView respondsToSelector:@selector(setLayoutMargins:)]) {
[self.tableView setLayoutMargins:UIEdgeInsetsZero];
}
}
- (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];
}
}
2. 不顯示沒(méi)內(nèi)容的 Cell
self.tableView.tableFooterView = [[UIView alloc] init];
3. 修改 Cell 小對(duì)勾的顏色
self.tableView.tintColor = [UIColor redColor];
4. 去掉 SectionHeaderView 的懸浮效果
- (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section {
return 60.0;
}
- (void)scrollViewDidScroll:(UIScrollView *)scrollView {
// UITableViewStylePlain 樣式下,去掉 SectionHeaderView 的懸浮效果
if (scrollView == self.tableView) {
CGFloat sectionHeaderHeight = 60.0;
if (scrollView.contentOffset.y<=sectionHeaderHeight && scrollView.contentOffset.y>=0) {
scrollView.contentInset = UIEdgeInsetsMake(-scrollView.contentOffset.y, 0, 0, 0);
} else if (scrollView.contentOffset.y>=sectionHeaderHeight) {
scrollView.contentInset = UIEdgeInsetsMake(-sectionHeaderHeight, 0, 0, 0);
}
}
}
5. 滾動(dòng)條偏移
self.tableView.scrollIndicatorInsets = UIEdgeInsetsMake(0, 0, 49, 0);
6. 沒(méi)有置頂
if ([self respondsToSelector:@selector(automaticallyAdjustsScrollViewInsets)] {
self.automaticallyAdjustsScrollViewInsets = NO;
}
7. 拖動(dòng)時(shí)收起鍵盤
self.tableView.keyboardDismissMode = UIScrollViewKeyboardDismissModeOnDrag;
8. 滑動(dòng)增加 Cell 動(dòng)效
// 實(shí)際項(xiàng)目中不推薦使用,為了一點(diǎn)點(diǎn)炫阐斜,而增加卡頓不值得牢硅。
- (void)tableView:(UITableView *)tableView willDisplayCell:(UITableViewCell *)cell forRowAtIndexPath:(NSIndexPath *)indexPath {
cell.alpha = 0.5;
CGAffineTransform transformScale = CGAffineTransformMakeScale(0.3, 0.8);
CGAffineTransform transformTranslate = CGAffineTransformMakeTranslation(0.5, 0.6);
cell.transform = CGAffineTransformConcat(transformScale, transformTranslate);
[tableView bringSubviewToFront:cell];
[UIView animateWithDuration:0.5f
delay:0
options:UIViewAnimationOptionAllowUserInteraction
animations:^{
cell.alpha = 1;
//清空 transform
cell.transform = CGAffineTransformIdentity;
}
completion:nil];
}
最后編輯于 :
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請(qǐng)聯(lián)系作者