I have a UITextView whose content I have set in my .xib.
I am trying to get it to recognize a link using these settings:
Unfortunately the link does not show up when I run in the simulator (it only shows as plain text):
How can I get the UITextView to recognize the link and display it properly?
Set your Textview behavior to Selectable ,
And make sure you have enabled User Interaction .
Related
I have an app that allows the user to edit a UITextView, however the copy/paste/cut bar pops on the iPad, blocking some of the bottom of the interface, as the following screenshot shows:
I would prefer getting rid of it instead of adjusting the interface, is there any way to accomplish this?
NOTE: This only appears on the iPad!
EDIT: My UITextView is entirely editable, therefore, this is not a duplicate of How disable Copy, Cut, Select, Select All in UITextView ! Also, I don't want to just disable the buttons, I want the whole bottom bar to go away!
EDIT 2: Updated the image for more clarity, as some answers are addressing the small black one that appears near the cursor.
You can hide this as below,
yourTextView.inputAssistantItem.leadingBarButtonGroups = []
yourTextView.inputAssistantItem.trailingBarButtonGroups = []
I have a need where I need to dynamically keep changing the underline status of a particular Text in Xamarin Forms label.
After referring multiple posts on how to underline a label, I tried both the options, creating a custom renderer as well as using Effects. The text underlines fine. However the problem is that the underline status of the Label doesn't update. This problem however is only in iOS, Android works fine.
I created a bindable property HasUnderline in my Custom Label class in Xamarin Forms. The OnElementPropertyChange method in iOS is fired within the CustomRenderer. I then also change the underline property of the control using
text.AddAttribute(UIStringAttributeKey.UnderlineStyle, NSNumber.FromInt32((int)NSUnderlineStyle.Single), range);
However, the same is not reflected in the UI.
After so many hours of my head banging, I finally, however, did notice that if I change the value of the Text, the underline immediately reflects. So it appears the changing the underline property doesn't reflect until something in the content of the text is changed. But I don't want to change the text while adding/removing the underline.
How can I solve this issue?
Is there some way to detect when the user changes assistant menu or how it is called?
I'm successfully updating the view position when keyboard show/hide or change the keyboard type emoji and etc. But I'm unable to find how to get notification when users hides or extends word suggestion area.
Image showing the action that I'm trying to catch http://i.stack.imgur.com/hY3di.png
What about UIKeyboardWillChangeFrameNotification?
I have ipad app i want that user should enter URL in textField and it should validate and should show like facebook when we enter any url it shows some page of that web or content like that in ipad any idea how to get this i know how to validate URL but how it show it like facebook page.
Attached is the screen how i want
I think you will do this in TextView not for TextField.
Some TextView do like this:
txt_note.editable=NO;
txt_note.dataDetectorTypes=UIDataDetectorTypeAll;
This will detect all URL,Phone NO,Address,etc.
OR(Method 2):
You can also see this in TextView Property in Xib file for TextView on
Right hand side.
personally i would create a customized view to show everything. You create a class URLSnapView subclass of UIView where you can place all the elements you need. a label to show the url, one for the description, a uiimageview to show your image. you can set up everything how you like it the most.
On the textfieldshouldreturn you can place the a validation method that return a BOOL value. If the result is true, it will create an instance of your customized URLSnapView with the data from your website that you will get with your NSDataDetectorType. You can also add a UIWebView to place a small area with your website that's even viewable ;)
I want to insert a URL hyperlink into a UITextField that has different display text.
This is super easy in html:
Go To Google
How can I do this in iOS?
You can change the text style inside your UITextField via an attributed string sent to the text field's "attributedText" property.
However, what I suspect you really want to do is have a link that's clickable. I would recommend using a UIButton with a custom type (i.e. no border) and you can set the color and the underline style.
But like Evan said, if you have multiple lines of text, it may be smarter to use a UITextField where you set "editable" to NO and turn on the LINK traits (both of these you can do from the object inspector in Xcode).
Alright, so here's what I did to get what I wanted. I used UIWebView, and simply linked it to an html page in the project that has the text, and hyperlink at the bottom with different text displayed.
Answer is here :
If you want it as clickable Hyperlink,
NSString *string = #"Go To Google";
You need to add "BACKWARD SLASH" before ". That's it.