- 1. UITableview不显示分割线
tableView.separatorStyle = UITableViewCellSeparatorStyleNone;
- 2. UITableview 不显示右侧箭头
cell.accessoryType = UITableViewCellAccessoryNone;注:其他的想修改的,自己修改后面类型
- 3. UITableview 选中状态
- 选中后处理
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{// 取消选中状态[tableView deselectRowAtIndexPath:indexPath animated:NO];}
cell.selectionStyle = UITableViewCellSelectionStyleNone
- 选中前处理不允许出现选中状态
- 4. 无数据不显示多余的cell行数(设置尾视图)
[chatView setTableFooterView:[[UIView alloc] initWithFrame:CGRectZero]];
- 5. UITableview指定刷新某行
/**
* table滚动到最后一行
*/
- (void)tableScrowToBottom
{
[_tableview scrollToRowAtIndexPath:
[NSIndexPath indexPathForRow:[dataArr count]-1 inSection:0]
atScrollPosition: UITableViewScrollPositionBottom
animated:NO];
}
- 6. UITableview指定显示某行
NSIndexPath *indexPath_1=[NSIndexPath indexPathForRow:arrIndex inSection:0];
NSArray *indexArray=[NSArray arrayWithObject:indexPath_1];
[_tableview reloadRowsAtIndexPaths:indexArray withRowAnimation:UITableViewRowAnimationAutomatic];
- 7. UITableview复用注意
在cell复用的时候前往要注意要将添加视图放在初始化里面,而不是外面,例如放在自己写的init方法里或者在if(cell == nil)里,这样当cell重新加载才不会重复添加视图到时界面视图重叠。