Hi! I've a custom UIImageView and I need to implement UIControl methods (like touchupinside) but I don't know how to do this. Here is my custom UIImage
#import "IngredientImage.h"
@implementation IngredientImage
@synthesize startLocation, initialFrame;
- (void)touchesBegan:(NSSet*)touches withEvent:(UIEvent*)event { // Retrieve the touch point
self.initialFrame = [self frame];
[self setAlpha:0.4];
CGPoint pt = [[touches anyObject] locationInView:self];
self.startLocation = pt;
[[self superview] bringSubviewToFront:self];
}
- (void)touchesMoved:(NSSet*)touches withEvent:(UIEvent*)event {
// Move relative to the original touch point
CGPoint pt = [[touches anyObject] locationInView:self];
CGRect frame = [self frame];
frame.origin.x += pt.x - self.startLocation.x;
frame.origin.y += pt.y - self.startLocation.y;
[self setFrame:frame];
}
- (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event {
if (CGRectIntersectsRect([self frame], landingView)) {
}
[self setAlpha:1];
[self setFrame:initialFrame];
}
- (void)dealloc {
[super dealloc];
}
@end
I need this in order to send a message to the controller of the view, like I do with a UIButton.
Thanks for any reply :)