UITableView的一些操作

来源:互联网 发布:库里20142015数据 编辑:程序博客网 时间:2024/05/10 08:05

1、刷新tableView的某个cell

NSIndexPath *indexPath = [NSIndexPath indexPathForRow:1 inSection:0];

[_bgTableView reloadRowsAtIndexPaths:[NSArray arrayWithObject:indexPath] withRowAnimation:UITableViewRowAnimationAutomatic];


2、刷新tableView的某个section

NSIndexSet *indexSet = [[NSIndexSetalloc] initWithIndex:sender.tag -10];

 [_bgTableViewreloadSections:indexSet withRowAnimation:UITableViewRowAnimationNone];


3、将tableView自动滚动到底部

[_bgTableViewscrollRectToVisible:CGRectMake(0,0, 0,0) animated:YES];


4、设置tableView默认选择第一个section的第一行cell

NSInteger selectedIndex = 0;

NSIndexPath *selectedIndexPath = [NSIndexPathindexPathForRow:selectedIndex inSection:0];

[_bgTableViewselectRowAtIndexPath:selectedIndexPath animated:NOscrollPosition:UITableViewScrollPositionNone];

0 0