|
TOC | PREV | NEXT
Interprocess Communication
GIFfun calls your Web Browser to display the created animated GIF by creating a Web page on the fly which references the created GIF. This is so easy, you are going to love Yellow Box!
To open a file with its default, user defined viewer:
[[NSWorkspace sharedWorkspace] openFile:htmlFile];
Here's the whole code to create an HTML file which references the newly created GIF so that it can be viewed:
#define HTML_CODE @"<HTML><HEAD><title>%@</title></HEAD><BODY BGCOLOR=\"#eeeeff\"><h2>%@</h2><HR><IMG SRC=\"%@\"></BODY></HTML>"
- (void)createAndOpenHTML:(NSString *)outFile
{
NSUserDefaults *ud = [NSUserDefaults standardUserDefaults];
NSString *htmlFile = [[outFile stringByDeletingPathExtension]stringByAppendingPathExtension:@"html"];
NSString *s = [NSString stringWithFormat:HTML_CODE,outFile,outFile,[outFile lastPathComponent]];
[[NSFileManager defaultManager] removeFileAtPath:htmlFile handler:nil]; // get rid of old
if ([s writeToFile:htmlFile atomically:NO] && [ud boolForKey:DEF_USE_BROWSER])
[[NSWorkspace sharedWorkspace] openFile:htmlFile];
}
TOC | PREV | NEXT
Created by Stone Design's Create on 4/30/1998
|
|