i have an unexpected behavior while swizzling a method on a UITableViewCell
category
my .m
file :
#import "UICollectionViewCell+CostraintFix.h"
#import <objc/runtime.h>
@implementation UICollectionViewCell (CostraintFix)
+(void)load {
Method original_setBounds, swizzled_setBounds;
original_setBounds = class_getInstanceMethod(self, @selector(setBounds:));
swizzled_setBounds = class_getInstanceMethod(self, @selector(swizzled_setBounds:));
method_exchangeImplementations(original_setBounds, swizzled_setBounds);
}
- (void) swizzled_setBounds:(CGRect) bounds{
[self swizzled_setBounds:bounds];
self.contentView.frame = bounds;
}
@end
Well, when i start my project i have this:
-[UINavigationButton swizzled_setBounds:]: unrecognized selector sent to instance 0x7fe2dbb301c0
- This is 100% a
UICollectionViewCell
category. - At this point, in
+(void) load
, onlyUITableViewCell
class are passing (as expected)