Feeds

Apple's ImageKit exposed

Inside view

Secure remote control for conventional and virtual desktops

Strictly speaking, those are the only delegate methods supported by IKImageView, but - like I said - other classes can potentially get in on the act. An internal class (IKComposer, if you're curious) will also examine the specified delegate object to see what delegate methods it supports. At this point, I'd like to thank Jim Turner for giving me a pointer on this one. Jim's a Cocoa Mac programmer from Iowa who I met and have been talking to on an Apple mailing list for Cocoa developers.

The delegate methods discovered by Jim are:

-(void) imageWillChange: (IKImageView *) imageView;
-(void) imageDidChange: (IKImageView *) imageView;
-(void) imageDidChange: (IKImageView *) imageView 
           imageState: (IKImageState *) state
image: (CGImageRef) image;  
- (NSUndoManager *) undoManagerForOperation: (NSString *) operation;

If your delegate responds to the more complex imageDidChange: method, then the simpler one will never be called: The two are mutually exclusive. For more information on IKImageState and IKComposer, use class-dump. Jim and I have discovered that imageWillChange: is always called reliably, but this isn't necessarily the case for the imageDidChange: variants.

NSImageView

IKImageView, and more, can be found inside Apple's latest Preview

Delegate methods aside, there are plenty of other interesting aspects to IKImageView. Use these methods to get a checkerboard background in your image view:

- (BOOL) showsCheckerboard;
- (void) setShowsCheckerboard: (BOOL) showsCheckerboard;

As mentioned earlier, double-clicking on an IKImageView will invoke the image-editing panel. One quirk of the image-editing panel is that it stubbornly refuses to go away when you switch over to another application.0 If - like me - you don't like this behaviour, you can fix it using the code below:

[[IKImageEditPanel sharedImageEditPanel] setHidesOnDeactivate: YES];

Another interesting feature of IKImageView is the tool mode. Apple document a number of tool modes, but in addition to the official modes, I've also discovered those below:

IKToolModeSelectEllipse
IKToolModeSelectLasso
IKToolModePaste*

It's pretty obvious from the names what these do. Bear in mind that IKToolModePaste is somewhat unusual - hence the star. You can't set this tool mode in the normal way using the setCurrentToolMode: method.

Finally, a number of folks have pondered the easiest way of getting an NSImage into an IKImageView. The documentation states you can use an NSImage, but the official setImage:imageProperties: method expects a CGImageRef. So, what to do? It turns out that Apple neglected to document another method called, simply, setImage:. Just pass an NSImage to via setImage, and you're good to go.

[_myImageView setImage: [NSApp applicationIconImage]];

There's no demo application this week to show undocumented aspects of IKImageView and other classes lurking inside ImageKit so no homework for you. Hopefully, though, you've got a taster for what IKImageView can do for you. ®

Top 5 reasons to deploy VMware with Tegile

More from The Register

next story
New 'Cosmos' browser surfs the net by TXT alone
No data plan? No WiFi? No worries ... except sluggish download speed
iOS 8 release: WebGL now runs everywhere. Hurrah for 3D graphics!
HTML 5's pretty neat ... when your browser supports it
Mathematica hits the Web
Wolfram embraces the cloud, promies private cloud cut of its number-cruncher
Mozilla shutters Labs, tells nobody it's been dead for five months
Staffer's blog reveals all as projects languish on GitHub
'People have forgotten just how late the first iPhone arrived ...'
Plus: 'Google's IDEALISM is an injudicious justification for inappropriate biz practices'
SUSE Linux owner Attachmate gobbled by Micro Focus for $2.3bn
Merger will lead to mainframe and COBOL powerhouse
iOS 8 Healthkit gets a bug SO Apple KILLS it. That's real healthcare!
Not fit for purpose on day of launch, says Cupertino
Netscape plugins about to stop working in Chrome for Mac
Google kills off 32-bit Chrome, only on Mac
prev story

Whitepapers

Secure remote control for conventional and virtual desktops
Balancing user privacy and privileged access, in accordance with compliance frameworks and legislation. Evaluating any potential remote control choice.
Intelligent flash storage arrays
Tegile Intelligent Storage Arrays with IntelliFlash helps IT boost storage utilization and effciency while delivering unmatched storage savings and performance.
WIN a very cool portable ZX Spectrum
Win a one-off portable Spectrum built by legendary hardware hacker Ben Heck
High Performance for All
While HPC is not new, it has traditionally been seen as a specialist area – is it now geared up to meet more mainstream requirements?
Beginner's guide to SSL certificates
De-mystify the technology involved and give you the information you need to make the best decision when considering your online security options.