NSImageView vs IKImageView
NSImageView vs IKImageView
- Subject: NSImageView vs IKImageView
- From: James Merkel <email@hidden>
- Date: Fri, 05 Aug 2011 14:07:32 -0700
As a follow on to a previous thread on thumbnails, I finally settled
on using Image I/O for creating a thumbnail from a file using a
CGImageRef.
However I could still use an NSImageView or an IKImageView to display
the image.
NSImageView requires converting the CGImageRef to an NSImage, with a
few lines of code, whereas a CGImageRef can be set directly into the
IKImageView.
Generally the NSImageView approach uses a lot less memory than
IKImageView, and also the IKImageView seems to leak memory. (Although
Instruments Leaks doesn't show the leaks.)
So NSImageView seems the way to go, however there is one nice side
effect for the IKImageView.
In my app, I accept edits in a window, save the edits to a file, close
the window, then reopen the window to show the changes.
With an NSImageView, you get an annoying flash when the window closes
and then opens again.
With an IKImageView you don't get the flash -- you can barely tell
that the window has closed and opened again. Much better appearance-
wise.
I am not sure why there is this difference between the two.
So that's my conclusion -- if you just need thumbnails (with no image
editing other than scaling and rotation) use Image I/O.
Jim Merkel
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden