how to use UIWebViewDelegate in wax?

119 views
Skip to first unread message

louis

unread,
Apr 11, 2012, 11:26:40 AM4/11/12
to iPhone Wax
I want to get uri in UIWebView where request uri changed.in oc code
is:

- (BOOL)webView:(UIWebView *)aWebView shouldStartLoadWithRequest:
(NSURLRequest *)request navigationType:
(UIWebViewNavigationType)navigationType
{
NSRange range = [request.URL.absoluteString
rangeOfString:@"code="];

if (range.location = NSNotFound)
{
returne NO;
}

return YES;
}

my question is :
wax how to write this ,
my wax code is,UIWebView work is ok,but method
webView_shouldStartLoadWithRequest don't work!

waxClass{"MyWebViewController",
UIViewController,protocols={"UIWebViewDelegate"}}


function init(self,frame)

self.webView=UIWebView:initWithFrame(frame)

self.webView.delegate =self;

self.url=NSURL:initWithString("http://m.google.com")

local request=NSURLRequest:requestWithURL(self.url)
self.webView:loadRequest(request)

self:view():addSubview(self.webView)

return self
end

function webView_shouldStartLoadWithRequest(self,webView,request,type)
puts("in shouldStartLoadWithRequest")
return true
end

cai

unread,
May 16, 2012, 1:52:40 AM5/16/12
to iPhone Wax
Should not use property on webview

webview:setDelegate(self) should work

louis

unread,
Jul 25, 2012, 11:55:26 PM7/25/12
to ipho...@googlegroups.com
can you give me a sample? I modified this line 

self.webView:setDelegate(self)  ,It can't work.

Reply all
Reply to author
Forward
0 new messages