Display URL link in iphone application view preferably on shortcut

I am trying to display a link to my login to register a new user. This link will say something like "Not a member" click here to register. This link, when clicked, should open Safari. What are my options. It would be nice to have a click event on UILabel. I can do this with a button, but it looks weird and would like to avoid using a button, unless it can look like a shortcut. Do not want to try UIWebView, it doesn’t look like my needs.

Any other ideas? I searched the Internet but could not find a useful approach.

+4
source share
3 answers

If someone is looking for something like this and is not able to figure out anything else, do the following.

Display the shortcut and put on the button on it, make it invisible (the type is set to custom) and determine the click on it. You can do anything, shortcut, image text, etc. etc.

+4
source

Try UITextView with editable = false and dataDetectorTypes = UIDataDetectorTypeLink

+3
source

Even better: put a RoundRectButton, set its type to Custom, adjust the text so that it looks like a link, and then associate the action with the button.

If the button text is the actual URL that you want to visit, bind all the link buttons to the same action handler:

[[UIApplication sharedApplication] openURL:[NSURL URLWithString:sender.currentTitle]]; 

for the included "http: //" or

 [[UIApplication sharedApplication] openURL:[NSURL URLWithString:[@"http://" stringByAppendingString:sender.currentTitle]]]; 

otherwise, i.e. A clean URL, such as "www.foo.net"

You get the added bonus of immediate visual feedback when you click the link button.

0
source

Source: https://habr.com/ru/post/1333738/


All Articles