Hello,

I am implementing mouse support in Core Animation. For this I have a CAButton : CALayer and adds button-related behavior : highlighting on mouseDown, stopping highlighting on mouseExit, etc. and actions.

The actions are associated using:
 -[CAButton setAction:(SEL) withTarget:(SEL)]

These are performed on mouseUp if the mouse is still within the button's rect.

The problem that occurred is that the action might cause the button to be removed by a side-effect of performSelector (ex. a view switch) and I might still need to perform additional actions that needs button's ivars after performSelector has been called (which might cause unexpected behavior).

When I encounter the problem, I changed mouseUp so it does not need to perform any action after the performSelector. But I am wondering if there are special practices to prevent this problem : should we assume that the button will not be released by the performAction, retain it before the performSelector and release it after, or do not use self after performSelector ?

Thanks for your advice,
Yvan
_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to