Feeds

Apple's ImageKit exposed

Inside view

Security for virtualized datacentres

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. ®

Intelligent flash storage arrays

More from The Register

next story
PEAK APPLE: iOS 8 is least popular Cupertino mobile OS in all of HUMAN HISTORY
'Nerd release' finally staggers past 50 per cent adoption
Microsoft to bake Skype into IE, without plugins
Redmond thinks the Object Real-Time Communications API for WebRTC is ready to roll
Microsoft promises Windows 10 will mean two-factor auth for all
Sneak peek at security features Redmond's baking into new OS
Mozilla: Spidermonkey ATE Apple's JavaScriptCore, THRASHED Google V8
Moz man claims the win on rivals' own benchmarks
FTDI yanks chip-bricking driver from Windows Update, vows to fight on
Next driver to battle fake chips with 'non-invasive' methods
DEATH by PowerPoint: Microsoft warns of 0-day attack hidden in slides
Might put out patch in update, might chuck it out sooner
Ubuntu 14.10 tries pulling a Steve Ballmer on cloudy offerings
Oi, Windows, centOS and openSUSE – behave, we're all friends here
Was ist das? Eine neue Suse Linux Enterprise? Ausgezeichnet!
Version 12 first major-number Suse release since 2009
prev story

Whitepapers

Why cloud backup?
Combining the latest advancements in disk-based backup with secure, integrated, cloud technologies offer organizations fast and assured recovery of their critical enterprise data.
Forging a new future with identity relationship management
Learn about ForgeRock's next generation IRM platform and how it is designed to empower CEOS's and enterprises to engage with consumers.
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?
New hybrid storage solutions
Tackling data challenges through emerging hybrid storage solutions that enable optimum database performance whilst managing costs and increasingly large data stores.
Getting ahead of the compliance curve
Learn about new services that make it easy to discover and manage certificates across the enterprise and how to get ahead of the compliance curve.