I have a simple UICollectionView based app - one UICollectionView and a NSMutableArray based data model for simplicity.
I can delete cells with no problem via the di
I found a crude but working workaround, and it even checks if action is already implemented in a future release (better than a category)
// Fixes the missing action method when the keyboard is visible
#import
#import
__attribute__((constructor)) static void PSPDFFixCollectionViewUpdateItemWhenKeyboardIsDisplayed(void) {
@autoreleasepool {
if ([UICollectionViewUpdateItem class] == nil) return; // pre-iOS6.
if (![UICollectionViewUpdateItem instancesRespondToSelector:@selector(action)]) {
IMP updateIMP = imp_implementationWithBlock(^(id _self) {});
Method method = class_getInstanceMethod([UICollectionViewUpdateItem class], @selector(action));
const char *encoding = method_getTypeEncoding(method);
if (!class_addMethod([UICollectionViewUpdateItem class], @selector(action), updateIMP, encoding)) {
NSLog(@"Failed to add action: workaround");
}
}
}
}
Edit: Added check for iOS5.
Edit2: We're shipping that in lots of commercial projects (http://pspdfkit.com) and it works great.