Re: A text view finishes getting images in HTML
Re: A text view finishes getting images in HTML
- Subject: Re: A text view finishes getting images in HTML
- From: Scott Anguish <email@hidden>
- Date: Fri, 28 Jun 2002 02:33:37 -0400
On Thursday, June 27, 2002, at 10:05 AM, Erik J. Barzeski wrote:
Hi,
I've got a text view through which I display either HTML or plain text.
Unfortunately, if an image in an HTML view isn't in the cache, the only
way
to display the image is to wait for it to download and somehow refresh
the
view.
What would be nifty is a "textViewDidFinishLoadingAllMyDarnPictures"
notification or something
Actually, it exists...
Each time your document is changed as it loads, it gets a
HTMLDocumentChangedNotification which has some useful information in the
key as far as what happened.
I wrote an article on this just after this was added (way back in
the Rhapsody days).. I'm not sure where it disappeared to.. but it
walked you though building an app in like 12 lines that could browse the
web.
The notifications are of course unofficial, and unsupported...
You can find out all sorts of cool stuff by using an app like this
#import "AppDelegate.h"
@implementation AppDelegate
- (void)awakeFromNib
{
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(gotNotification:) name:NULL object:NULL];
}
- (IBAction)loadURL:(id)sender
{
NSAttributedString *theStr;
NSURL *theURL = [NSURL
URLWithString:@"
http://www.stepwise.com/index.html"];
theStr=[[NSMutableAttributedString alloc] initWithHTML:[theURL
resourceDataUsingCache:NO]
baseURL:theURL
documentAttributes:NULL];
[[theText textStorage] setAttributedString:theStr];
}
- (void)gotNotification:(NSNotification *)notification
{
if ([[notification name] hasPrefix:@"HTML"]) {
NSLog(@"[notification object] %@",[notification object]);
NSLog(@"[notification name] %@",[notification name]);
NSLog(@"[notification userInfo] %@",[notification userInfo]);
}
}
@end
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.