检测在UIWebview中单击的链接

时间:2012-06-19 08:33:55

标签: objective-c xcode ios4

我的iPhone应用中有一个UIWebView,其网页上有几个按钮,每个按钮都有一个特殊的URL

有没有办法检测在此特定UIWebView点击网址的时间?

1 个答案:

答案 0 :(得分:-3)

-(void)ButtonPressed:(id)sender {

UIButton *btnCurrent = (UIButton*)sender;
NSLog(@"sender%@",sender);

NSString *str = [NSString stringWithFormat:@"%d",btnCurrent.tag];
    strRID =str;
    if ([str isEqualToString:@"0"]) {
    NSURL *urldata = [NSURL URLWithString:strLink];
    NSURLRequest *request = [[NSURLRequest alloc] initWithURL:urldata];
    [self.webRegister setScalesPageToFit:YES];
    [self.webRegister loadRequest:request];
    [request release]; 
    [super viewDidLoad];
    strLink=@"";
     }
 }