beginUpdates
endUpdates
插入指定的行,
在执行该方法时,会对数据源进行访问(分组数据和行数据),并更新可见行。所以,在调用该方法前,应该先更新数据源
- (void)insertRowsAtIndexPaths:(NSArray *)indexPaths withRowAnimation:(UITableViewRowAnimation)animation
插入分组到制定位置
- (void)insertSections:(NSIndexSet *)sections withRowAnimation:(UITableViewRowAnimation)animation
插入一个特定的分组。如果,指定的位置上已经存在了分组,那么原来的分组向后移动一个位置。
删除制定位置的分组
- (void)deleteSections:(NSIndexSet *)sections withRowAnimation:(UITableViewRowAnimation)animation
删除一个制定位置的分组,其后面的分组向前移动一个位置。
移动分组 和 行
- (void)moveSection:(NSInteger)section toSection:(NSInteger)newSection
移动原来的分组从一个位置移动到一个新的位置。如果,新位置上若存在某个分组,那这某个分组将会向上(下)移动到临近一个位置。该方法,没有动画参数。会直接移动。并且一次只能移动一个分组。
-(BOOL)tableView:(UITableView *)tableView canMoveRowAtIndexPath:(NSIndexPath *)indexPath
移动行
单元格操作
提交
-(void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath
能否编辑
-(BOOL)tableView:(UITableView *)tableView canEditRowAtIndexPath:(NSIndexPath *)indexPath
必须开启 tableview.editing 这个属性为真可以编辑.
tableview.accessoryType
typedef enum : NSInteger {
UITableViewCellAccessoryNone, //正常风格
UITableViewCellAccessoryDisclosureIndicator, //最右边有一小箭头
UITableViewCellAccessoryDetailDisclosureButton, //最右边有一按钮式的小箭头
UITableViewCellAccessoryCheckmark, //右边有一对勾
UITableViewCellAccessoryDetailButton //按钮
} UITableViewCellAccessoryType;
tableView.autoresizingMask
UIViewAutoresizingNone = 0 //控件相对于父视图坐标值不变;
UIViewAutoresizingFlexibleLeftMargin = 1 << 0 //到屏幕左边的距离随着父视图的宽度按比例改变;
UIViewAutoresizingFlexibleWidth = 1 << 1 //控件的宽度随着父视图的宽度按比例改变,例如:label宽度为100,屏幕的宽度为320。当屏幕宽度为480时,label宽度变为100*480/320
UIViewAutoresizingFlexibleRightMargin = 1 << 2 //到屏幕右边的距离随着父视图的宽度按比例改变;
UIViewAutoresizingFlexibleTopMargin = 1 << 3 //到屏幕上边的距离随着父视图的宽度按比例改变;
UIViewAutoresizingFlexibleHeight = 1 << 4 //UIViewAutoresizingFlexibleWidth相同
UIViewAutoresizingFlexibleBottomMargin = 1 << 5 //到屏幕底边的距离随着父视图的宽度按比例改变;
注意:此时该cell的- (void)setSelected:(BOOL)selected animated:(BOOL)animated将被调用,所设置的selected为NO;