UITableView点击切换状态分析
原理:多选+点击动画
初始化和点击都调用的方法
- (void)changeStateAnimated:(BOOL)animated { //不需要动画,初始化的时候 if (animated == NO) { TapAnimationModel *model = self.dataAdapter.data; if (model.selected == NO) { //不勾选状态 [self hideIconAnimated:NO]; } else { //勾选状态 [self showIconAnimated:NO]; } } //需要动画,点击的时候 else { TapAnimationModel *model = self.dataAdapter.data; if (model.selected == NO) { model.selected = YES; [self showIconAnimated:YES]; } else { model.selected = NO; [self hideIconAnimated:YES]; } } }
然后[self hideIconAnimated:YES],[self showIconAnimated:YES]显示不同的UI位置大小等,期间用多个动画组合就行了