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.
ex:
- make sure class conforms to:
<uitextviewdelegate>
- set textview delegate:
[textview setdelegate:self];
- implement delegate method:
...
#pragma mark - uitextviewdelegate - (bool)textview:(uitextview *)textview shouldinteractwithurl:(nsurl *)url inrange:(nsrange)characterrange { // open custom map using data textview.text. }
Comments
Post a Comment