2012-02-02 8 views

答えて

3

HTMLでは、URLに特別なスキームを指定します。この例では、スキームがperformです:

<!-- ontouchstart tells WebKit to send us mouse events on a touch platform so we can use :active --> 
<button class="button" ontouchstart="" onclick="window.open('perform:MAX')">MAX</button> 

(あなたが<a hrefここまたは他の技術を使用することができます。この例では、onclickを使用することが有用であったコードから来ている。。)

の代理人としてあなたのコントローラを設定します。 UIWebView。次に、このデリゲートメソッドを実装します。

- (BOOL)webView:(UIWebView *)webView shouldStartLoadWithRequest:(NSURLRequest *)request 
               navigationType:(UIWebViewNavigationType)navigationType 
{ 
    NSURL *url = request.URL; 
    if ([[url scheme] isEqualToString:@"perform"]) 
    { 
    // url.resourceSpecifier will be @"MAX" in this example 
    // Do something with it. 
    return NO; 
    } 

    return YES; 
} 
+0

COOL!どうもありがとう! – uriel

関連する問題