1

I am importing all tags of a HTML page to UITextView. but i have few on click events like mail and phone in this HTML tags. how can i detect that on click event and open it in UIWebView.

DD_
  • 7,230
  • 11
  • 38
  • 59
Pradeep Kumar
  • 401
  • 5
  • 18

2 Answers2

0

When you on click events, do you simply mean that you want to make things like the email address, phone # etc to be tappable, such that tapping a phone # would open the Phone app etc?

If so, have you tried simply setting the UITextView's properties in Interface Builder > Attributes Inspector.

See my image below:

enter image description here

noobzilla
  • 1,095
  • 2
  • 11
  • 17
0

suppose are you displaying String in UIWebView like bellow But First you must configure your webView outlet and connect proper Delegate then put below code in to ViewWillApear:-

[webview loadHTMLString:[NSString stringWithFormat:@"%@
Have an enquiry for %@? Click hear and we will be in touch with you.* {margin:0;padding:0; font-family:Arial;font-size:15px;text-align:justify}", yourStringDiscription,YourHyperlinkWord] baseURL:nil];

in Above script this line:- :[NSString stringWithFormat:@"<html><body text=\"#000000\">%@ <br>Have an enquiry for %@? Click <a href=\"inapp://\">hear</a>

in first %@ is for String of contain and second %@ for your Hyparlink

Now

you can get click event of this webViewdelegate method

-(BOOL) webView:(UIWebView *)inWeb shouldStartLoadWithRequest:(NSURLRequest *)inRequest navigationType:(UIWebViewNavigationType)inType {
    if ( inType == UIWebViewNavigationTypeLinkClicked ) {

       //Got even here put breck point
       return NO;
    }

    return YES;

}

you can got click event in above delegate hope you undastood what i am saying and hope its help's you

Nitin Gohel
  • 49,482
  • 17
  • 105
  • 144