Hi,

I have a separate XIB in which there is an NSPanel containing an image view to set an image. When I call a method, it creates a new instance of the controller for the nib, loads the nib, and then sets the image of the image view via the controller object. Like this:

- (IBAction)newImagePanelForImage:(NSImage*)aImage
{
ImagePanelController *ctrl = [[[ImagePanelController alloc] init] autorelease];
        [NSBundle loadNibNamed:@"ImagePanel" owner:ctrl];
        [ctrl setImage:aImage];
}

ImagePanelController is set as the File's Owner of the ImagePanel.nib file. The controller itself is very simple:

//// Header

@interface ImagePanelController : NSObject {
        IBOutlet NSImageView *mImageView;
}
- (void)setImage:(NSImage*)pic;
@end

//// Implementation

#import "ImagePanelController.h"

@implementation ImagePanelController

- (void)setImage:(NSURL*)pic
{
        [mImageView setImage:pic];
}
@end

Most of this works just fine. When I call the method, a new panel pops up and the image is displayed. The problem is, once I call the method again to create another instance, the new panel pops up, and within seconds any existing instances of the panel just vanish. I have no idea what I'm doing wrong, I have GC turned on, could that be the problem?

The weird part about this is that I did this code weeks ago and it never had that problem, and without me changing anything directly related with the nib, panel, controller, etc. this issue appeared.

Any help is appreciated
Thanks
_______________________________________________

Cocoa-dev mailing list ([email protected])

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [email protected]

Reply via email to