3

I am putting an image into an IKImageView, and immediately sizing it to fit. Whenever I do this, the image originally appears at 1-1 size (huge) and then resizes down, which would be fine if the animation was smooth. However, the animation looks ... fluttery? There are big blocks, like 2 inches square, of the image that appear and shrink independently of each other. The effect is a little annoying, and almost to the level where it might give an epileptic a seizure... (I'm exaggerating a little).

Is this a bug in IKImageView? Is it a bug in the animation? Will it go away if I turn off the animation (How do I do that? setAnimates: NO doesn't seem to do anything, nor does overloading animates to return NO in my subclass...

EDIT: addedcode:

NSImage* image = [doc currentImage];
[imageView setImage: image];
[imageView zoomImageToFit: self];

This is in the app controller, so self is the application (or plugin, depending on which version I'm looking at)

STW
  • 44,917
  • 17
  • 105
  • 161
Brian Postow
  • 11,709
  • 17
  • 81
  • 125
  • Can you post the code you're using to add the image and size it? – Rob Keniger Mar 23 '10 at 21:34
  • note that IKImageView's setImage: method is actually PRIVATE. I'm currently using it in a mac app store app and haven't been rejected for it, but I'm removing it in the next version because I only just now realized it was private. Use `CGImageRef refImg = [img CGImageForProposedRect:NULL context:NULL hints:NULL]; [imageView setImage:refImg imageProperties:nil];` instead. – Kenny Winker Feb 22 '11 at 07:48

1 Answers1

2

If you tell the IKImageView to autoresize, then it won't animate the new image to the new size and the artefacts will not be a problem. The image will be sized to fit in the image view immediately.

imageView.autoresizes = YES;
Rob Keniger
  • 45,830
  • 6
  • 101
  • 134