ios - Attributed Text View that opens address in new map view -


i'm working on app uses parse backend , allows users post address via text view. enabled "addresses" attribute , addresses open in apple maps app. instead i'd keep users in app opening new view map , address tapped pinned map view.

is there anyway can without making things overly complicated?

thanks help!

you can implement uitextviewdelegate method:

- (bool)textview:(uitextview *)textview shouldinteractwithurl:(nsurl *)url inrange:(nsrange)characterrange; 

description: asks delegate if specified text view should allow user interaction given url in given range of text.

the text view calls method if user taps or long-presses url link. implementation of method optional. default, text view opens application responsible handling url type , passes url. can use method trigger alternative action, such displaying web content @ url in web view within current application.

reference

ex:

  1. make sure class conforms to: <uitextviewdelegate>
  2. set textview delegate: [textview setdelegate:self];
  3. implement delegate method:

...

#pragma mark - uitextviewdelegate  - (bool)textview:(uitextview *)textview shouldinteractwithurl:(nsurl *)url inrange:(nsrange)characterrange {      // open custom map using data textview.text.  } 

Comments

Popular posts from this blog

android - MPAndroidChart - How to add Annotations or images to the chart -

javascript - Add class to another page attribute using URL id - Jquery -

firefox - Where is 'webgl.osmesalib' parameter? -