UITableView知识总结

1.设置cell默认选中状态

- (void)tableView:(UITableView *)tableView willDisplayCell:(UITableViewCell *)cell forRowAtIndexPath:(NSIndexPath *)indexPath {
    if (indexPath.row == self.selectedIndex) {
        [tableView selectRowAtIndexPath:indexPath animated:NO scrollPosition:UITableViewScrollPositionNone];
    }
}

一定要在willDisplayCell代理方法中设置,否则设置的选中状态没有效果

2.如何去除tableView的section header和section footer在plain模式下的悬浮效果?

将header和footer放到单独的section中,记住:只要section中没有cell,那么它的header和footer就没有悬浮效果   
最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容