Skip to content

Commit

Permalink
changed for UIWebView.
Browse files Browse the repository at this point in the history
  • Loading branch information
kishikawakatsumi committed Feb 8, 2009
1 parent 42a5bf0 commit a92e13c
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions Classes/WebViewController.m
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
#import "HUDMessageView.h" #import "HUDMessageView.h"
#import "JSON/JSON.h" #import "JSON/JSON.h"
#import "Debug.h" #import "Debug.h"
#import <objc/runtime.h>


@implementation WebViewController @implementation WebViewController


Expand All @@ -13,6 +14,10 @@ @implementation WebViewController
@synthesize pageURL; @synthesize pageURL;
@synthesize lastPageURL; @synthesize lastPageURL;


static NSObject *webViewcreateWebViewWithRequestIMP(id self, SEL _cmd, NSObject* sender, NSObject* request) {
return [sender retain];
}

- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil { - (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil {
if (self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil]) { if (self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil]) {
UIBarButtonItem *commentButton = [[UIBarButtonItem alloc] initWithImage:[UIImage imageNamed:@"Comment.png"] UIBarButtonItem *commentButton = [[UIBarButtonItem alloc] initWithImage:[UIImage imageNamed:@"Comment.png"]
Expand Down Expand Up @@ -157,8 +162,7 @@ - (void)webViewDidFinishLoad:(UIWebView *)aWebView {
backButton.enabled = (webView.canGoBack) ? YES : NO; backButton.enabled = (webView.canGoBack) ? YES : NO;
forwardButton.enabled = (webView.canGoForward) ? YES : NO; forwardButton.enabled = (webView.canGoForward) ? YES : NO;


self.title = [aWebView stringByEvaluatingJavaScriptFromString: self.title = [aWebView stringByEvaluatingJavaScriptFromString:@"document.title"];
@"try {var a = document.getElementsByTagName('a'); for (var i = 0; i < a.length; ++i) { a[i].setAttribute('target', '');}}catch (e){}; document.title"];


LOG_CURRENT_METHOD; LOG_CURRENT_METHOD;
} }
Expand All @@ -178,6 +182,9 @@ - (void)webView:(UIWebView *)aWebView didFailLoadWithError:(NSError *)error {
- (void)viewDidLoad { - (void)viewDidLoad {
[super viewDidLoad]; [super viewDidLoad];
[webView setBackgroundColor:[UIColor whiteColor]]; [webView setBackgroundColor:[UIColor whiteColor]];
Class UIWebViewWebViewDelegate = objc_getClass("UIWebViewWebViewDelegate");
class_addMethod(UIWebViewWebViewDelegate, @selector(webView:createWebViewWithRequest:),
(IMP)webViewcreateWebViewWithRequestIMP, "@@:@@");
} }


- (void)viewWillAppear:(BOOL)animated { - (void)viewWillAppear:(BOOL)animated {
Expand Down

0 comments on commit a92e13c

Please sign in to comment.