In my project I have an NSImageView
and I drop a picture from the finder on it. In an IBAction
I want to take care if the picture size is bigger than the dimensions of the NSImageView
as shown below.
I hoped that sender.size
or sender.size.x
or sender.size.width
would give me the size of the NSImageView
imageDropped but it doesn't.
Any ideas how I can get the dimensions of the NSImageView
?
- (IBAction)imageWasDropped:(id)sender {
NSImage *theImage = [imageDropped image];
NSLog(@"%@", sender); // this returns <NSImageView: 0x10011d210>
NSSize _dimensions = [theImage size];
if (_dimensions.width > sender.size){
}
[imageOriginal setImage:theImage];
[picture_1 setImage:theImage];
}