Ns_class_available_ios(6_0) Uirefreshcontrol There is a problem sometimes out of the bug animation pull off, here are given the repair process:
@interface Uicollectionview (fixrefreshcontroljump) @end
#import "Uicollectionview+fixrefreshcontroljump.h"#import<objc/runtime.h>@implementationUicollectionview (fixrefreshcontroljump)+ (void) load{Method Originmethod= Class_getinstancemethod ([Uicollectionviewclass], @selector (setcontentinset:)); Method Newmethod= Class_getinstancemethod ([Uicollectionviewclass], @selector (setnewcontentinset:)); Method_exchangeimplementations (Originmethod, Newmethod); Uirefreshcontrol}- (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]; }}@end
Deal with the problem by Method_exchangeimplementations Swzing Way
Recommended reading:
Http://www.cnblogs.com/kesalin/archive/2012/01/05/objc_method_swizzling.html