How to display text on iOS - ios

I'm new to Xcode an trying to design a basic text app. I'm wondering what the best way to display mutable text that cannot be edited by the user. Thanks for any help.

Depending on how much text you want display
1) UILabel for short things...won't be editable
2)and UITextView for large texts (set editable property to false)

Related

How to format a text like bold/italic in UITextField in Swift iOS?

Here consider this image. I have taken a toolbar with icons for text formatting. After selecting that sentence if I hit B (bold) it should be bold. Even I need that too if I select bold then further text to be show as bold. Consider this textbox UITextField. Incase you have some good reference like github you are welcome. I have already spend two days in a row in SO but not get any proper solution. One bold function is enough for me.

is there any way to Underline some text of UILabel and make it Clickable?

I have following text in UILabel. I want to underline both text. and give them click event and open related link.
I Agree to the Terms & Conditions and Hotel Booking and Cancellation Policies
but problem is I couldn't give separate click event for both underlined text.
What is the best way to do that?
I know one option give separate label for all four string. but it is harder to maintain position of all that label for different sizes
Appreciate for help!!!!
take a look of this library Might be it will help you: https://github.com/TTTAttributedLabel/TTTAttributedLabel
Suggest to change the UI design. A possible work around I found is add UILabel below this text label/button with text contains a number of under scores(_) and pin it with auto layout. N.B: It's never ever a good practice at all.

How do you add uneditable text in an iOS app

I now a label can create static text, but I have a few paragraphs that are neatly formatted that need to go to my app. How can I do this without using a label?
You can use a UITextView and set the editable property to NO

In iOS, how do I programmatically display dynamically changing values in a text field?

I have Objective C code that continually updates a set of numerical values. I need to display these values on the screen. That's it! I can convert numerical values into a text string, no problem. But how do I display this string in a UI element? Do I use a text box or a text field or a text view, or a...? I cannot find examples to show how to pass a string from code into the UI. I assume I need to set up a text thingy, and then periodically refresh the contents of that text thingy when the values change?
I assume the answer is simple but is just obscured by a smokescreen of technical jargon.
Thanks!
From the UI perspective you might want something like a
UITextView - multi-line text input
UITextField - single-line text input
UILabel - just text
For your purpose of just printing text, you should use UILabel, since you dont want / need any kind of input. You can access its text using:
// yourLabel is your current UILabel* you want to output yourValue to
yourLabel.text = yourValue;
Of course that yourValue needs to be converted to NSString before.
To actually get hold of the UILabel, you need to connect it from the Interface Builder as an IBOutlet. For tutorials on that topic, take a look at tutorials like Interface Tutorials by Ray Wenderlich or youtube or just google Interface Builder tutorial.

iOS: URL link in UITextField with different text

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.

Resources