Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

rocotilos

macrumors newbie
Original poster
Nov 8, 2010
6
0
Hi.

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.
Code:
- (void)windowDidResize:(NSNotification *)notification {
    
   // NSLog(@"resized");
    
    NSRect zWindowRect = [[self window]frame];
    NSRect zContentRect = [[self window]contentRectForFrameRect:zWindowRect];

    [self.imageView setFrameSize:NSMakeSize(zContentRect.size.width,
                                            zContentRect.size.height)];
    
    [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?
 
Scaling is set to Proportional so that was not the problem.

I have found out the cause though - "Use Auto Layout" was checked for the NIB file.

Unchecked that and everything works well now.
Thanks for replying though. :)
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.