这应该是个Bug,在程序切到后台,再切回来,下拉动画就没了,菊花不转。
有段代码可以尝试修复这个问题,但是只能对TableView的子类有效:
#import <objc/runtime.h>
+ (void)load {
Method originMethod = class_getInstanceMethod([UICollectionView class], @selector(setContentInset:));
Method newMethod = class_getInstanceMethod([UICollectionView class], @selector(setNewContentInset:));
method_exchangeImplementations(originMethod, newMethod);
}
- (void)setNewContentInset:(UIEdgeInsets)contentInset {
if (self.tracking) {
CGFloat diff = contentInset.top - self.contentInset.top;
CGPoint translation = [self.panGestureRecognizer translationInView:self];
translation.y -= diff * 3.0 / 2.0;
[self.panGestureRecognizer setTranslation:translation inView:self];
}
if ([self respondsToSelector:@selector(setNewContentInset:)]) {
[self setNewContentInset:contentInset];
}
}