H file
# Import <Foundation/Foundation. h>
@ Interface hftouchbutton: uibutton
{
}
@ End
M file
# Import "hftouchbutton. H"
@ Implementation hftouchbutton
Bool touchmoved;
-(ID) initwithframe :( cgrect) Frame
{
Self = [Super initwithframe: frame];
If (Self ){
// Initialization code
}
Return self;
}
-(Void) touchesbegan :( nsset *) touches withevent :( uievent *) event
{
Touchmoved = no;
[[Self superview] touchesbegan: touches withevent: event];
[Super touchesbegan: touches withevent: event];
}
-(Void) touchesmoved :( nsset *) touches withevent :( uievent *) event
{
Touchmoved = yes;
[[Self superview] touchesmoved: touches withevent: event];
[Super touchesmoved: touches withevent: event];
}
-(Void) touchesended :( nsset *) touches withevent :( uievent *) event
{
[[Self superview] touchesended: touches withevent: event];
If (! Touchmoved)
{
[Super touchesended: touches withevent: event];
}
}
@ End