Hi All
I am using textview in cocoa How we show a HTML data in textview
Thanks Deepika
Hi All
I am using textview in cocoa How we show a HTML data in textview
Thanks Deepika
You can use an UIWebView and fill it with a string instead of a webpage.
You didn't say if you're targeting the Mac or the iPhone. I'll assume the Mac since you tagged your question with cocoa.
It would be worth looking into the Text System documentation for an overview of how NSTextView
works. But at a basic level, all NSTextView
s have an NSTextStorage
object (accessible via the textStorage
method) NSTextStorage
happens to be a subclass of NSMutableAttributedString
.
NSAttributedString
has an initializer called initWithHTML:baseURL:documentAttributes:
which will parse an HTML string for you. Once you've got that, you can append the resulting string to your NSTextView
's textStorage
. For example:
NSData *htmlData = // get the html, e.g. from a file
NSURL *aBaseURL = // a URL used to resolve relative links e.g. '/directory/page.html'
NSAttributedString *formattedHTML = [[NSAttributedString alloc] initWithHTML:htmlData baseURL:aBaseURL documentAttributes:NULL];
[[myTextView textStorage] appendAttributedString:formattedHTML];
[formattedHTML release];
Why not use a WebView (part of the WebKit framework)? Although NSTextView has rudimentary HTML support, WebView gives you all of the power of the modern, standards-compliant, WebKit framework.
this is for MAc not for i-phone
I am using webkit for showing HTML data... but some scrolling problem in webkit
so I want to use textview for it.. I have store html data in database... as also sending this as a html mail
One of my old post
I am using web-view in my application and showing a message content in HTML format When I try to forward a long message I am setting the web view editable. In this case the scroll of web-view is not working properly
means.. when I am pressing Enter after first 2-3 lines then those lines go upward from viewing before I reach the bottom of the page.
My forwarded message is in the 1st Photo of link http://picasaweb.google.com/battan20/Error#
When I press some Enter after a few lines then first line goes slightly upward after pressing a few enter. as in 2nd Photo When I press some more Enter after the line then first line goes slightly upward, as in 3nd Photo.... as so on
As per normal scroll work first line should not goes upper until my cursor not reach in the end of page
Thanks Deepika
Also need HTML value as output from textview... like [textview htmlValue]...