Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Update: From <a href="/questions/tagged/ios10" class="post-tag" title="show questions tagged &#39;ios10&#39;" rel="tag">ios10</a>, </p> <pre><code>- (BOOL)textView:(UITextView *)textView shouldInteractWithURL:(NSURL *)URL inRange:(NSRange)characterRange interaction:(UITextItemInteraction)interaction; </code></pre> <p>From <a href="/questions/tagged/ios7" class="post-tag" title="show questions tagged &#39;ios7&#39;" rel="tag">ios7</a> and Later <code>UITextView</code> has the delegate method:</p> <pre><code>- (BOOL)textView:(UITextView *)textView shouldInteractWithURL:(NSURL *)URL inRange:(NSRange)characterRange *NS_DEPRECATED_IOS(7_0, 10_0, "Use textView:shouldInteractWithURL:inRange:forInteractionType: instead");* </code></pre> <p>to intercept the clicks to links. And this is the best way to do it.</p> <p>For <a href="/questions/tagged/ios6" class="post-tag" title="show questions tagged &#39;ios6&#39;" rel="tag">ios6</a> and earlier a nice way to do this is to by subclassing <code>UIApplication</code> and overwriting the <code>-(BOOL)openURL:(NSURL *)url</code></p> <pre><code>@interface MyApplication : UIApplication { } @end @implementation MyApplication -(BOOL)openURL:(NSURL *)url{ if ([self.delegate openURL:url]) return YES; else return [super openURL:url]; } @end </code></pre> <p>You will need to implement <code>openURL:</code> in your delegate. </p> <p>Now, to have the application start with your new subclass of <code>UIApplication</code>, locate the file main.m in your project. In this small file that bootstraps your app, there is usually this line:</p> <pre><code>int retVal = UIApplicationMain(argc, argv, nil, nil); </code></pre> <p>The third parameter is the class name for your application. So, replacing this line for:</p> <pre><code>int retVal = UIApplicationMain(argc, argv, @"MyApplication", nil); </code></pre> <p>This did the trick for me.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload