I have a UITextView object. The text in UITextView has a phone number, mail link, a website link and also normal text messages.
I used dataDetectorTypes to detect links and number. Links and number are detected using this method but I was only able to click website link. I want to click number and mail link also.
Note: I don't want to use webview for this.
Thanxs in advance,
Mayur
If you are creating UITextView using UI then in property window -> detection section there is options available are
Links ,Addresses,Phone Numbers and Events
select whatever you want
P.S if you want to enable this detection then do the following in property window -> Behavior section uncheck Editable option otherwise it will not detect
Related
I created an OS X text editor application (with swift) that uses an NSTextView.
When you right click a link in NSTextView you can choose edit and then a panel pops up and enables you to edit the link.
Is there a way to on insert a link in the same way?
I know NSTextView recognizes links automatically but that does not provide the functionality I need. I need the ability to insert link text and link url that are different from one another.
I currently implemented this by letting the user select text and showing a popup (after pressing cmd+K) where he can enter the link. Then I add the link by:
textStorage?.addAttribute(NSLinkAttributeName, value: url, range: range)
This works, but it seems really strange that apple won't implement this kind of basic behavior in an important control as NSTextView.
Am I missing something?
Am working in message based iPhone app. I have added UITextView to show the messages typed by the user. This app allows the user to copy the messages. Whenever the user selects the messages in the bubbles the Copy option showing in middle of UITextView. How to show the Copy option in Top of the TextView?
Can anyone please help me to solve this issue? Thanks in advance.
Gopinath, this is in-built. You cannot change the default behavior. One option could be to write your own custom TextView which would show the copy option at the top. A workaround could be this:
Just let the user select the text (disable showing 'copy' in the UITextView)
You add a button at the top of the bubble
When the user selects the text & clicks on your UIButton 'copy', then copy whatever is the selection programmatically in your own method.
I have a table view and in some of the cells there are links, I want to be allow the user to click on these links and view them in a webView (which I have already made). I don't want to use the row selection event because there may be more than one link in the cell. I came across TTTAttributedLabel and think it will be ideal. I don't need to add any style to the text in the cell, I only need to detect the links and capture the click event to open up my webview.
Any help would be greatly appreciated.
It looks like you can assign a TTTAttributedLabelDelegate to a TTTAttributedLabel that will get call backs for when a user selects different link types, but no opportunity for you to capture them and open your own web view (which I think is what you're trying to accomplish).
Instead, you might wanna check out OHAttributedLabel. It's similar in functionality, but when a user clicks on one of the links in the label, it calls -(BOOL)attributedLabel:(OHAttributedLabel*)attributedLabel shouldFollowLink:(NSTextCheckingResult*)linkInfo on it's OHAttributedLabelDelegate, which gives you the opportunity to handle the link tap yourself if you return NO.
I have a block of text shown like:
What I am trying to accomplish is that when I add the test to this table view cell, I want to make a specific word or group of words clickable. Lets take the group of words Grand Turk Lighthouse for example. Is there a way to add a href to the word that when I click it, it will send me to say View2 which is in the app. I am building an app that will not go to the internet and so I want a way for the link to be clickable to send to another page within the app. Thanks for any help provided.
I can't give you specific answer, but you may try this :
https://github.com/AliSoftware/OHAttributedLabel
it also could give different style, color, and href in one label.
another alternative, is to use UIWebView, and listen / delegate to it. load html within the app.
hope it helps.
I was wondering whether any of you may have an idea how to mimic the behavior of the native Mail app on the iPhone, when selecting email contacts in the To/CC lines.
If you note carefully, when touching that line the keyboard opens and you get a cursor, which is like the normal behavior of a UITextField. However, after keying a name and selecting it, the name is added inside a blue bubble. Still fine - one could create the bubble and move the text field. However, if you go back using the backspace key - the blue bubble becomes marked (darker blue), the cursor disappears, but the keyboard stays visible.
Any idea how to accomplish that?
Thanks!
Ariel
Check out the Three20 control library from the Facebook: https://github.com/facebook/three20
Either the TTMessageController, or the TTPickerTextField control are what you want. For using TTPickerTextField there's a good demo here: https://github.com/shayne/TTPickerTextFieldDemo