Re: IKImageView delegate
Re: IKImageView delegate
- Subject: Re: IKImageView delegate
- From: Brian Postow <email@hidden>
- Date: Mon, 12 Apr 2010 10:39:11 -0400
On Apr 10, 2010, at 2:13 AM, Gerriet M. Denkmann wrote:
> The documentation (updated this morning) says: "An IKImageView object’s delegate [...] is informed of various actions by the image view through delegation messages."
>
Why do you say that the documentation has been edited? When I look at it, it says it was edited in February...
The answer to most of your questions seems to be "The IKImageView documentation is lousy and buggy" (they mention that you can but an NSImage into an IKImageView, but there is no documented method for this for example...)
> This begs the question: What are these "delegation messages" and where are they documented?
>
> Also: IKImageView seems to understand the cut:, copy:, paste: etc. messages. But I can't find any documentation about this (neither in IKImageView nor in it's superclasses).
I wrote my own using the get the region method described below. It's not elegant, but it seems to work... I also just used the code from IKImageViewDemo and trusted that it would work... Note that it uses undocumented methods!
> According to the documentation cut: seems to be implemented only by NSText and WebView.
>
I'm not sure what you want cut to do in an IKImageView, make the area grey?
> Another thing: IKImageView can mark a region (IKToolModeSelect). How to get this region from IKImageView? (Clumsy workaround: send it a copy: message and look at the pasteboard).
There is an *UNDOCUMENTED* method (CGRect)selectionRect which returns the selection rectangle in view coordinates. I use a separate version of the image and do: (full is the CGImageref of the whole image)
CGRect selection;
selection = flipCGRect( CGImageGetHeight(full), [imageView selectionRect]);
CGImageRef selectedImage;
if (selection.size.width == 0 || selection.size.height == 0)
selectedImage =full;
else
selectedImage = CGImageCreateWithImageInRect( full, selection);
it's not elegant, but it seems to work.
Again, selectionRect is UNDOCUMENTED so use it at your own risk!
Brian Postow
Senior Software Engineer
Acordex Imaging Systems
_______________________________________________
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