Difference between UIWebView Fontsize and UItextView Fontsize - iphone

Can any one tell me what is the major difference between UIWebView's font size property and UITextView's FontSize property??
Both are different, As UIWebView's Fontsize is very bigger then UITextView's font size, through both are 15..
Please tell me, What is the difference?
Thanks in advance..

Following is working properly.
<html><body style="margin-top:0px; margin-left:0px"><marquee behavior="alternate" style="font-family:verdana;font-size:10px; color:red;">Test</marquee></font></body></html>

although both are rendering HTML but main difference is,
UIWebView giving u the HTML view its font size denpend ViewPort,
where as the UITextView can control its font size.

According to the official Objective C website:
"This class does not support multiple styles for text. The font, color, and text alignment attributes you specify always apply to the entire contents of the text view. To display more complex styling in your application, you need to use a UIWebView object and render your content using HTML."
How I understood it: on a UIVewView you can use as text HTML tags, in UITextView it will be displayed as a plain text. The UIWebView's font's size depends from the ViewPort, and you have no direct access to it, as well as the UITextView has properties for the font size setup.

Related

iPhone iOS5 How can I present a font type, size, color and alignment widget to the user?

I have a few UITextFields and I would like the user to be able to change the font's appearance within those fields.
Right now I have a UIToolbar with 5 buttons used for font controls. One for font name, one for size, one for color and one for alignment.
To change font, I display a picker with the fonts family names, letting the user pick default font for that family.
For the font color, I display another toolbar with a font size slider
For font color, I display an open source color picker
For font alignment, I display a button that cycles through the left/center/right alignment.
Finally there's a close button that hides the toolbar.
Currently all of my code is in one controller, but I would like to have it refactored into a separate, reusable class.
Since I'll be rewriting code, are there any open source font controls like I'm describing above? Maybe I can just plug in something that's already made into my project?
Thank you!
It wouldn't be very hard at all. Instead of pickers use a scroll view with buttons and labels above them using the font. As for size you could do the same!
This would be easy in Xcode 4, not so sure in 3.X.X
I found that the attributed string example by apple does have a table view-like font controller that includes a preview of what fonts look like. I think extending that controller may be the easiest thing to do:
http://developer.apple.com/library/ios/#samplecode/CoreTextPageViewer/Introduction/Intro.html

In iOS, how do you embed images inline with text (in a UITextView)?

How can you create a UITextView that can have images inline? I looked up NSAttributedString, but it seems iOS does not support image attachments. Any ideas for an editable text view that can display images (I suppose RTF would do this)?
Thanks in advance for your help!
The only method I am aware of is to use a UIWebView. There is no way to add images to a UITextView, unfortunately, just plain text.
You could use the NSTextAttachment class. It lets you insert images inline of text.
I found an example of this in a cool project here: https://github.com/dzog/ImgGlyph. ImgGlyph provides UITextView and UILabel subclass implementations that help you replace specific strings with images and ensures they're sized correctly with respect to the text surrounding it.

Xcode UITextView Change textcolor of specified word

I would like to change the font color of a certain word inside a UITextView.
if([text1.text isEqualToString:#"value"]) {
}
That's what I have right now, and I want the word value to change font color, any ideas? Sorry if it's simple but I'm still learning ;)
It's not possible, sorry.
from UITextView Class Reference
This class does not support multiple
styles for text. The font, color, and
text alignment attributes you specify
always apply to the entire contents of
the text view. To display more complex
styling in your application, you need
to use a UIWebView object and render
your content using HTML.

How do I apply CSS to style the text in a UILabel?

I would like to be able to style the text in a UILabel using CSS. I know that you can use a UIWebView to load HTML to be formatted for display using
[webview loadHTMLString:myText baseURL:nil];
but I would like to simply style just a UILabel without relying on UIWebView. How can I do this?
Look at the open source project called FontLabel at http://wiki.github.com/zynga/FontLabel.
Although it won't let you apply a CSS file to a UILabel, it does provide a subclass of UILabel that can use custom fonts and styling.
Of course you can also use the standard properties of UILabel like color, textAlignment, etc.
Since css file structure is very easy you could create a simple css parser that searches a certain id or class. Then get the font size, name, style and other attributes and instead of using UILabel you maybe want use CATextLayer because text is much more customizable (colors, font, size, style, and even more than one fonts in a single line)
But I wonder why do you need a UILabel and not UIWebView?
Hope it helps

Should I use UIWebView or UITextView to display text in an e-book reader app?

I want to make an e-book reader iPhone app. Should I use UITextView or UIWebView to display the text? Which control is used by other e-book readers?
I would use a UIWebView, as it gives you much more flexibility in the presentation of the text. According to the UITextView Class Reference:
This class does not support multiple
styles for text. The font, color, and
text alignment attributes you specify
always apply to the entire contents of
the text view. To display more complex
styling in your application, you need
to use a UIWebView object and render
your content using HTML.
Also, UITextView uses scrolling to display large amounts of text (it inherits from UIScrollView); in an e-book reader, you will most likely want to paginate the content, so you will not want the scrolling behaviour.
UIWebView is much better solution than UITextView mainly due to support of rich formatting of its contents. On the other hand you will miss some very important functions which you get for free while using UITextView. I'm talking mostly about searching inside, changing contents size etc. All of this is possible with UIWebView but it's not straightforward - css & javascript are for the help here
Did you get highlight functionality for this as font size can change. Save them for future so that when ever he came to same page can see them
U should use UIWEB view ,as to provide paragraph and other functions of text are not supported by text view, u can directly implement html code and can make the app with proper view of text. So my suggestion is to use web view.