Advertise here

Advertise here

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

NSImageView resize

rocotilosrocotilos Posts: 3,297iPhone Dev SDK Supporter, Registered Users @ @ @ @ @
edited October 2012 in Mac OS X Development

I'm just playing around with OSX app dev. I'm totally noob.
I thought it is straight forward like iOS app dev. But after a few days
of going at this, it seems it is not that easy.

Here's what I'm trying to do. I have a NSWindow. In it I put an Image Well (wth with the naming? lol)
Well, it is an NSImageView (no pun intended).

So I just want the NSImageView frame to resize following the NSWindow size. It's that simple.

Here's what I did that is NOT working:

NSImageView as imageView.

write the delegate method of NSWindow windowDidResize and just resize the framesize
of imageView in it.
- (void)windowDidResize:(NSNotification *)notification {
   // NSLog(@"resized");
    NSRect zWindowRect = [[self window]frame];
    NSRect zContentRect = [[self window]contentRectForFrameRect:zWindowRect];

    [self.imageView setFrameSize:NSMakeSize(zContentRect.size.width,
    [self.imageView setNeedsDisplay:YES];

This delegate is called (tested with that NSLog).
However the NSImageView just stays there with the original size.
I checked the IBOutlet connection is ok.

What gives? Why won't the NSImageView resize?
Sign In or Register to comment.