In my application i have a text view with a large content which shows some help tips for the user.In that text view i have to make bold some titles.can i set it in my interface builder?anyone have idea?is it possible with any other uiobjects like uilabel or something?I tried with an image view but it is not clear.
-
Possible duplicate of http://stackoverflow.com/questions/1436839/uitextview-rich-text – Devraj Dec 30 '11 at 04:45
2 Answers
Since you are using the text view to show help tips I assume it is non editable. If you want richer formatting in this case then I think UIWebView offers better solution, as it supports entire HTML markup. So you can use bold, italics and pretty much everything that CSS offers.
- 765
- 7
- 22
I think you are looking for UIFont. You can set the font property or text, and assign it to your label/textview/etc.. with the setFont property.
UIFont* boldFont = [UIFont boldSystemFontOfSize:[UIFont systemFontSize]];
UIFont* italicFont = [UIFont italicSystemFontOfSize:[UIFont systemFontSize]];
Please read through the Documentation of UIFont !
Note: UITextView allows only a single uniform font for all text. If you want different font size I would suggest that you create separate UILabel and UITextView and add them as subviews to your self.view, and align them perfectly. This should solve the problem. But if you want to use only one object for this operation, I would suggest UIWebView, or CoreText or may be CATextLayer's NSAttributedString.
- 12,145
- 12
- 79
- 132
-
-
-
Some bold titles and then some non bold text. Granted it's not the clearest question but thought I would try save you getting the stroppy down votes people love to give. The hint for me was `... some titles` – Paul.s Dec 30 '11 at 04:51
-
@Paul.s Sorry, I did not think that might also be the question... Its now edited. – Legolas Dec 30 '11 at 05:00
-
now i added the labels separately for the titles and the content in a scroll view.can i justify the content inside this scroll view? – iOS Developer Dec 30 '11 at 05:07
-
@Paul.s,can i align both left and right of a text view or a label?any tricks – iOS Developer Dec 30 '11 at 05:14
-
Yes you can align any object you want. Set the `frame` with proper x and y values. ... – Legolas Dec 30 '11 at 05:15