UITableView知识总结
2016-06-20 本文已影响53人
fallrainy
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就没有悬浮效果