Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save g761007/6e1f44ce9b4b5b746e77 to your computer and use it in GitHub Desktop.
Save g761007/6e1f44ce9b4b5b746e77 to your computer and use it in GitHub Desktop.
Hacking UIApplication that replace original method 'setNetworkActivityIndicatorVisible' to hidden network activity indicator forever.
/// UIApplication+DisableNetworkActivityIndicatorVisible.h
#import <UIKit/UIKit.h>
@interface UIApplication (DisableNetworkActivityIndicatorVisible)
@end
/////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////
/// UIApplication+DisableNetworkActivityIndicatorVisible.m
#import "UIApplication+DisableNetworkActivityIndicatorVisible.h"
#import <objc/runtime.h>
@implementation UIApplication (DisableNetworkActivityIndicatorVisible)
+ (void)load {
Method original, swizzled;
original = class_getInstanceMethod(objc_getClass("UIApplication"), @selector(setNetworkActivityIndicatorVisible:));
swizzled = class_getInstanceMethod(self, @selector(swizzled_setNetworkActivityIndicatorVisible:));
method_exchangeImplementations(original, swizzled);
}
- (void)swizzled_setNetworkActivityIndicatorVisible:(BOOL)yesOrNo {
// pass
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment