From 1736478a1e8d1fc865faedfcfe25e2f31dd3bc74 Mon Sep 17 00:00:00 2001 From: ljh Date: Wed, 6 Jul 2016 14:22:49 +0800 Subject: [PATCH] Fix AnimationDidStop Called --- Classes/Private/UITableView+IMYAOPTableView.h | 1 + Classes/Private/UITableView+IMYAOPTableView.m | 19 +++++++++++++++++++ Classes/TableUtils/IMYAOPTableViewUtils.m | 1 + 3 files changed, 21 insertions(+) diff --git a/Classes/Private/UITableView+IMYAOPTableView.h b/Classes/Private/UITableView+IMYAOPTableView.h index c0c94da..6475b3a 100644 --- a/Classes/Private/UITableView+IMYAOPTableView.h +++ b/Classes/Private/UITableView+IMYAOPTableView.h @@ -14,6 +14,7 @@ + (SEL)aop_updateRowDataSEL; + (SEL)aop_rebuildGeometrySEL; + (SEL)aop_updateContentSizeSEL; ++ (SEL)aop_updateAnimationDidStopSEL; + (Class)imy_aopClass; @end diff --git a/Classes/Private/UITableView+IMYAOPTableView.m b/Classes/Private/UITableView+IMYAOPTableView.m index 943b9d8..d711b3b 100644 --- a/Classes/Private/UITableView+IMYAOPTableView.m +++ b/Classes/Private/UITableView+IMYAOPTableView.m @@ -112,6 +112,15 @@ + (SEL)aop_updateContentSizeSEL }); return sel; } ++ (SEL)aop_updateAnimationDidStopSEL +{ + static SEL sel; + static dispatch_once_t onceToken; + dispatch_once(&onceToken, ^{ + sel = NSSelectorFromString([NSString stringWithFormat:@"%@%@", @"_updateAnimationDidStop:", @"finished:context:"]); + }); + return sel; +} - (IMYAOPTableViewUtils*)aop_uiCallingUtils { IMYAOPTableViewUtils* aop_utils = self.aop_utils; @@ -277,6 +286,16 @@ - (void)aop__updateContentSize ((void (*)(void*, SEL))(void*)objc_msgSendSuper)(&objcSuper, [UITableView aop_updateContentSizeSEL]); aop_utils.isUICalling -= 1; } +- (void)aop__updateAnimationDidStop:(id)arg1 finished:(id)arg2 context:(id)arg3 +{ + IMYAOPTableViewUtils* aop_utils = [self aop_uiCallingUtils]; + aop_utils.isUICalling += 1; + struct objc_super objcSuper; + objcSuper.receiver = self; + objcSuper.super_class = self.aop_utils.tableViewClass; + ((void (*)(void*, SEL, id, id, id))(void*)objc_msgSendSuper)(&objcSuper, [UITableView aop_updateAnimationDidStopSEL], arg1, arg2, arg3); + aop_utils.isUICalling -= 1; +} - (void)aop_layoutSubviews { IMYAOPTableViewUtils* aop_utils = [self aop_uiCallingUtils]; diff --git a/Classes/TableUtils/IMYAOPTableViewUtils.m b/Classes/TableUtils/IMYAOPTableViewUtils.m index 96c38c4..be00e48 100644 --- a/Classes/TableUtils/IMYAOPTableViewUtils.m +++ b/Classes/TableUtils/IMYAOPTableViewUtils.m @@ -216,6 +216,7 @@ - (void)setupAopClass:(Class)aopClass [self addOverriteMethod:[UITableView aop_updateRowDataSEL] aopClass:aopClass]; [self addOverriteMethod:[UITableView aop_updateContentSizeSEL] aopClass:aopClass]; [self addOverriteMethod:[UITableView aop_rebuildGeometrySEL] aopClass:aopClass]; + [self addOverriteMethod:[UITableView aop_updateAnimationDidStopSEL] aopClass:aopClass]; [self addOverriteMethod:@selector(beginUpdates) aopClass:aopClass]; [self addOverriteMethod:@selector(endUpdates) aopClass:aopClass]; [self addOverriteMethod:@selector(reloadSectionIndexTitles) aopClass:aopClass];