How to get click event of email link in UITextView? - ios

I am new in iPhone development. I am doing a contact us page. Here I uses a UITextView to display the details. In it, there is a email address link (abc#company.com). When a user tapped on the email link, the iPhone's default mail app needs to be appear. But I don't know how to get the click event of the email link in UITextView.
How can I achieve this ?.
I know how to load mail app. But before that I want to do some other things. So how can i get a click event when user taps on the email link in UITextView ?

The iOS SDK does not expose this event in a UITextView. If you want to intercept a tap on an email link, you will have to use a UIWebView instead of the text view.

you can do it with uiwebview in your html content try this <a href="mailto:abc#company.com">

Related

Put User-Interaction in the process of UIActivityViewController

I have a problem. I want to mail some data either in the form of exce or csv or pdf.
The Flow is , I have to present an UIActivityViewController. The I Have to click on the mail button. Then activity view controller should disappear. Then a view will came (made by me) that will ask about the format of file which i have to mail. Then next the mail view will open asking about the email address etc. The i will click send and it will sent.
My problem is:- I am using UIActivityViewController but i dont know how to stop its process as i click on mail and put some user interaction in between.
Please Help.
You need to call the activityDidFinish: method on the chosen UIActivity.
From the docs for UIActivity activityDidFinish::

UILabel text as tags and hyperlink

I have a string which I am getting from the server and is dynamic. It is of the format:
<p> John Appleseed Hey http://google.com </p>
Couple of related questions I want to ask in one thread
I want to make the mention text and the URL text to appear in bold and different colour
When URL is tapped it should open a the link in WebView
When the mention text is tapped, it should perform some other action (open User Profile VC)
When tapping mention text, it should send a parameter (uid) to the method, the uid can be extracted from mentions-32 (32 is uid here)
This string can have multiple mentions and links. I am stripping off the HTML tags and I get plain text. I know there is library TTTAttributedLabel which can be used here
Note: This functionality can be compared to what facebook or twitter app does on Newsfeed post text. (Tapping on tag takes the user to User Profile and tapping on the hyperlink opens a webview)
I think the better option to use the GLTapLabel GitHub Demo it is useful for the custom UILabel view controller for iOS that works just like a regular UILabel.
Hope this Demo is helpful u.

How to get the description for a link tapped in UIWebView

How can I get the description of a link that a user has tapped in the UIWebView before loading the request?
This question seemed to ask the same thing, but what he actually wanted was the URL, which is not my case. I just want to know what is the text description of the link that has been tapped by the user.

Tweet button with dynamic text and events

I want to have an input field in my page and a button so that the user can manually enter the tweet text and then when he its the submit button, the actual twitter status submit will open with the text the user entered.
moreover, I also want to get a callback when a user submit the tweet on twitter like Web Intents Javascript Events
as far as I know there are 2 ways to do that:
re-render the tweet button after every change of the input using twttr.widgets.load();, something like this example, only instead of the update button use the onchange event of the input. the problem is when the tweet button is re-rendered its disappears for a moment.
the next option is not to use the twitter button, instead when the user hits submit open a new window and redirect to https://twitter.com/share with the tweet text as the query param (like twitter suggest in Build Your Own Tweet Button). the problem with this solution is that I dont get an event when the user submit the tweet on twitter.
Any ideas how I can combine both requirements, dynamically change the tweet text & getting an event on tweet submit?
Not sure if this would work, but my first thought is to use the tweet button, and add an invisible div over it which will capture the user's click, reload the widget with the user's text, and trigger a click on the widget 250ms later (or however long it might take it to reload on a slow device). You'll only get one flicker, so it wouldn't look smooth, but it wouldn't look like a bug either.

How to make a UIButton looks like a email link button?

I am doing a contact us page. Here I want to add a email link and also I want to open the iPhone's default mail app while clicking that link. I don't know how to make the UIButton looks like a link button.
How can I achieve this?
Change the button type to UIButtonTypeCustom

Resources