IBOutlets and savePanels
IBOutlets and savePanels
- Subject: IBOutlets and savePanels
- From: Andrew Merenbach <email@hidden>
- Date: Sat, 13 Jul 2002 18:20:05 -0700
I have questions on two completely different things. The first is about
IBOutlets. In my program, I have a file, Controller.h, which has in it:
IBOutlet NSTextField *textField;
However, in some other sample code, I've seen it also as:
IBOutlet id textField;
Both of the above examples seem to function identically as long as the
textField outlet is connected to a text field from within Interface
Builder. Is there an advantage to using one over the other?
My second question regards the save panel, which doesn't seem to work
when I try to use it as a sheet. I get a warning: "NSSavePanel does not
respond to..." when I use the following code, which I carefully based
off of an example elsewhere:
NSSavePanel *sp;
int runResult;
/* create or get the shared instance of NSSavePanel */
sp = [NSSavePanel savePanel];
/* set up new attributes */
[sp setRequiredFileType:@"txt"];
/* display the NSSavePanel */
runResult = [sp beginSheetForDirectory:NSHomeDirectory()
file:@"X-Quotient Output"]; // modalForWindow:myWindow modalDelegate:
nil
/* if successful, save file under designated name */
if (runResult == NSOKButton) {
if (![[quotientText string] writeToFile:[sp filename]
atomically:YES])
NSBeep();
}
}
Take care,
Andrew Merenbach
_______________________________________________
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.