Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- static void swizzleInstanceMethod(Class class, SEL originalAction, SEL swizzledAction) {
- method_exchangeImplementations(class_getInstanceMethod(class, originalAction),
- class_getInstanceMethod(class, swizzledAction));
- }
- static void swizzle() {
- swizzleInstanceMethod(UIView.class, @selector(didMoveToSuperview),
- @selector(ftg_didMoveToSuperview));
- }
- __attribute__((constructor)) static void FTGBorderConstructor(void) {
- @autoreleasepool {
- swizzle();
- }
- }
- #pragma mark - UIView
- @interface UIView (FTGBorder)
- @end
- @implementation UIView (FTGBorder)
- - (void)ftg_didMoveToSuperview {
- self.layer.borderWidth = 1;
- self.layer.borderColor = [UIColor brownColor].CGColor;
- [self ftg_didMoveToSuperview];
- }
- @end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement