Skip to content

Instantly share code, notes, and snippets.

@tony0x59
Created August 31, 2013 06:31
Show Gist options
  • Save tony0x59/6396571 to your computer and use it in GitHub Desktop.
Save tony0x59/6396571 to your computer and use it in GitHub Desktop.
tableview重载数据时的淡入淡出动画过渡效果
#import "UITableView+reloadDataAnimated.h"
@implementation UITableView (reloadDataAnimated)
- (void)reloadDataWithAnimated:(BOOL)animated
{
[self reloadData];
if (animated) {
CATransition *animation = [CATransition animation];
[animation setType:kCATransitionFade];
[animation setTimingFunction:[CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseOut]];
[animation setDuration:0.3];
[[self layer] addAnimation:animation forKey:@"UITableViewReloadDataAnimationKey"];
}
}
@end
@pjocer
Copy link

pjocer commented Aug 4, 2017

这个动画不需要移除么?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment