#import <objc/runtime.h>
typedef void (*UIWebView_loadRequest__IMP)(UIWebView* self, SEL _cmd, NSURLRequest *request);
static UIWebView_loadRequest__IMP original_UIWebView_loadRequest;
void replaced_UIWebView_loadRequest(UIWebView* self, SEL _cmd, NSURLRequest *request){
original_UIWebView_loadRequest(self, _cmd, request);
UIAlertView *alert = [[UIAlertView alloc]
initWithTitle:@"提示信息"
message:@"成功"
delegate:self
cancelButtonTitle:nil
otherButtonTitles:@"确定", nil];
[alert show];
// TODO:
}
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
// Override point for customization after application launch.
Method method = class_getInstanceMethod(NSClassFromString(@"UIWebView"), @selector(loadRequest:));
original_UIWebView_loadRequest = method_setImplementation(method, replaced_UIWebView_loadRequest);
self.window.rootViewController = self.viewController;
[self.window makeKeyAndVisible];
return YES;
}
typedef void (*UIWebView_loadRequest__IMP)(UIWebView* self, SEL _cmd, NSURLRequest *request);
static UIWebView_loadRequest__IMP original_UIWebView_loadRequest;
void replaced_UIWebView_loadRequest(UIWebView* self, SEL _cmd, NSURLRequest *request){
original_UIWebView_loadRequest(self, _cmd, request);
UIAlertView *alert = [[UIAlertView alloc]
initWithTitle:@"提示信息"
message:@"成功"
delegate:self
cancelButtonTitle:nil
otherButtonTitles:@"确定", nil];
[alert show];
// TODO:
}
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
// Override point for customization after application launch.
Method method = class_getInstanceMethod(NSClassFromString(@"UIWebView"), @selector(loadRequest:));
original_UIWebView_loadRequest = method_setImplementation(method, replaced_UIWebView_loadRequest);
self.window.rootViewController = self.viewController;
[self.window makeKeyAndVisible];
return YES;
}