objective c - Cocoa : Image Well - Custom NSImageView class doesn't show image? -



objective c - Cocoa : Image Well - Custom NSImageView class doesn't show image? -

i added imagewell via interface builder, set image, ran , well. (the image displayed).

however, if alter custom class 1 of own (nsimageview subclass), image no longer displayed. bare class nil added. reason why wouldn't work?

i tried manually set image in initwithframe method:

[self setimage:[nsimage imagenamed:@"image.png"]]; [self setimagealignment:nsimagealigncenter]; nslog(@"image valid? %@", [[self image] isvalid] ? @"yes" : @"no");

but did not work. no errors, no image shown.

any ideas might mistake?

make sure phone call super drawrect within drawrect method.

- (void)drawrect:(nsrect)dirtyrect { [super drawrect:dirtyrect]; // drawing code here. }

objective-c cocoa nsimage nsimageview

Comments

Popular posts from this blog

web services - java.lang.NoClassDefFoundError: Could not initialize class net.sf.cglib.proxy.Enhancer -

Accessing MATLAB's unicode strings from C -

javascript - mongodb won't find my schema method in nested container -