NSMenu problems showing/hiding HUD NSPanel
Still having great difficulty with this problem. Any suggestions?
I cannot find a simple tutorial online that explains the basics of NSPanel windowing as different from NSWindow.
I have an HUD window that I'd like to show as a notification & input box, but I cannot for the life of me figure out how. My attempts are below.
I know this is a poorly phrased and overly broad question; being new to Objective C and Interface Builder, I do not quite yet have my feet wet enough to be more specific.
In relevant part: AppController.h
@interface AppController : NSObject {
IBOutlet NSMenu *statusMenu;
IBOutlet id HUDPanel;
IBOutlet NSTextField *HUDTextField;
IBOutlet NSTextField *HUDLabel;
IBOutlet NSProgressIndicator *HUDSpinner;
NSStatusItem *statusItem;
NSImage *statusImage;
NSImage *statusHighlightImage;
}
- (IBAction)recognizeCurrentLocation:(id)sender;
- (IBAction)saveButtonPressed:(id)sen开发者_如何转开发der;
- (IBAction)newLocationMenuItem:(id)sender;
- (IBAction)HUDPanelHide:(id)sender;
- (IBAction)HUDPanelShow:(id)sender;
@end
In relevant part: AppController.c
- (IBAction)HUDPanelHide:(id)sender{
[HUDPanel close];
}
- (IBAction)HUDPanelShow:(id)sender{
[HUDPanel makeKeyAndOrderFront:self];
}
And I am fairly sure that my linking in IB is correct - I followed a tutorial to set most of this up, and menu items that I have assigned to other actions are properly executing.
The tutorial I found was here:
http://www.mataderu.com/xphere/info/cocoa_tut02/OpenGLrules.zip
Apparently my answer was that I was not creating a "utility window" - e.g. I had an *.xib instead of a *.nib file.
I'm not sure why this makes a difference so perhaps more explanation from an expert would be worth noting here.
Otherwise, my code was exactly what it should be.
精彩评论