Re: ikimageview delegate
Re: ikimageview delegate
- Subject: Re: ikimageview delegate
- From: Martin Hewitson <email@hidden>
- Date: Tue, 13 Sep 2011 20:44:19 +0100
On Sep 13, 2011, at 06:12 PM, Andy Lee wrote:
> On Sep 13, 2011, at 12:49 PM, Martin Hewitson wrote:
>> So this almost provides the answer. I made a subclass and in there override setRotationAngle:centerPoint: but this triggers for every mouse movement, rather than for an accumulated drag from the user. I then tried to override mouseUp with the plan to set a flag didRotate in setRotationAngle:centerPoint: and then send a delegate message or notification on mouseUp, then reset the flag. Unfortunately IKImageView doesn't receive a mouseUp: when rotating. This works for moving the image, but not rotating. So I guess for now I will try to live with the many messages to the delegate, but I would have liked to quantise this at the level of the user's action, so bracketed by mouseDown: and mouseUp:. If anyone has any ideas how this might be achieved, I'd be happy to hear them.
>
> Sounds like mouseDown: implements its own drag loop when it detects that you're rotating the image. Test: if you override mouseDown: and do an NSLog, followed by super, followed by another NSLog, when does the second NSLog get called? Right way, or at the end of your drag?
>
ok, good clue. The second NSLog gets called when you stop the drag (so just before mouse up). Still not sure I understand why mouseUp: is not called, but this is probably enough for me to set some flags and implement some decent delegate messages from my subclass. I'll post back the subclass when it's all working.
Thanks again,
Martin
> If this theory is correct, you can set a flag in setRotationAngle:centerPoint: that says "the image was rotated" and check for that flag in mouseDown:. You might also need a flag in mouseDown: that says "the mouse is down, so henceforth any rotation of the image should be noted." Something like that.
>
> --Andy
>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Martin Hewitson
Albert-Einstein-Institut
Max-Planck-Institut fuer
Gravitationsphysik und Universitaet Hannover
Callinstr. 38, 30167 Hannover, Germany
Tel: +49-511-762-17121, Fax: +49-511-762-5861
E-Mail: email@hidden
WWW: http://www.aei.mpg.de/~hewitson
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
_______________________________________________
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