UIWebView识别链接代码

来源:互联网 发布:135端口入侵教程 编辑:程序博客网 时间:2024/05/22 13:27

    NSString *linkString = [NSStringstringWithString:@"<a href=\"http://apple.com\">Apple</a>"];

    

    NSString *connnectString = [[NSString alloc] initWithFormat:@"this string is %@",linkString];

    

    UILabel *stringLabel = [[UILabel alloc] initWithFrame:CGRectMake(20,120, 200, 20)];

    [stringLabelsetText:connnectString];

    [self.viewaddSubview:stringLabel];

    

    UIWebView *webView = [[UIWebView alloc] initWithFrame:CGRectMake(20,150, 200, 200)];

    [webViewloadHTMLString:connnectString baseURL:nil];

    [webViewsetScalesPageToFit:YES];

//    [webView setDetectsPhoneNumbers:YES];//识别地区号码

    [self.viewaddSubview:webView];

    

    [webViewrelease];

    [stringLabelrelease];

    [connnectStringrelease];


原创粉丝点击