NSView loaded from bundle won't draw...
Hi,
I am trying to load an NSScreenSaverView and display it in a PrefPane much like Apple's screensaver prefpane's screenssaver preview. I am loading the screensaver bundle and I know that the bundle is loading correctly because I have put an NSLog in a custom screensaver and it is being displayed in the console when I run this PrefPane.
Here's the function where I put my code and the code:
The description displays properly, the initWithFrame: function is run on the bundle, but I can't get "theStupidView", (IBOutlet id theStupidView
to display. Yes, I'm frusterated
. My .h file is linked to DesktopSaverPref in IB. The loaded class is a ScreenSaverView, a subclass of NSView. I really don't understand why it isn't drawing anything.
Anyone?
Thanks,
Joseph Duchesne
I am trying to load an NSScreenSaverView and display it in a PrefPane much like Apple's screensaver prefpane's screenssaver preview. I am loading the screensaver bundle and I know that the bundle is loading correctly because I have put an NSLog in a custom screensaver and it is being displayed in the console when I run this PrefPane.
Here's the function where I put my code and the code:
Code:
- (void) mainViewDidLoad
{
SSBundle = [NSBundle bundleWithPath:@"/System/Library/Screen Savers/Flurry.saver"];
Class SSBundleClass;
NSLog(@"Bundle Info\n%@",[ [ SSBundle infoDictionary ] description ] );
NSLog(@"Found and loaded principalClass");
theStupidView = [[SSBundleClass alloc] initWithFrame:NSMakeRect(0,0,100,100) isPreview:YES];
[theStupidView startAnimation];
}The description displays properly, the initWithFrame: function is run on the bundle, but I can't get "theStupidView", (IBOutlet id theStupidView
to display. Yes, I'm frusterated
. My .h file is linked to DesktopSaverPref in IB. The loaded class is a ScreenSaverView, a subclass of NSView. I really don't understand why it isn't drawing anything.Anyone?
Thanks,
Joseph Duchesne
You're trying to set an outlet to a different view and hope that the view the outlet was set to changes. This is not possible. Instead, you'll need to add the view to the view hierarchy, i.e. determine a view that it should be a subview of and then use addSubview, replaceSubview or a similar method to add the view there.
Possibly Related Threads...
| Thread: | Author | Replies: | Views: | Last Post | |
| grayscale loaded as gl_alpha: all texture is white | sefiroths | 2 | 4,732 |
Jan 18, 2011 12:34 AM Last Post: sefiroths |
|
| grayscale loaded as gl_alpha: the opaque image can be only white? | sefiroths | 2 | 5,088 |
Jan 14, 2011 08:06 AM Last Post: sefiroths |
|
| Mouse Events in NSView | Chandhu | 1 | 3,555 |
Feb 28, 2008 02:08 AM Last Post: kuon_ |
|
| Drawing a subview loaded from a bundle | Joseph Duchesne | 8 | 4,686 |
Feb 14, 2006 08:32 PM Last Post: PowerMacX |
|
| NSImage and NSView problems | Joseph Duchesne | 1 | 3,305 |
Aug 19, 2005 07:36 AM Last Post: unknown |
|

