The size of any view (NSView, NSImageView, etc.) is view.frame.size
or view.bounds.size
. In both cases, this is an identical NSSize
structure. You can write code like this:
NSSize size = newImageView.frame.size; NSLog(@"size: %@", NSStringFromSize(size)); NSLog(@"size: %fx %f", size.width, size.height);
To change it, you need to update the view frame
property:
NSRect frame = view.frame; frame.size = NSMakeSize(<#new width#>, <#new height#>); view.frame = frame;
source share