Friday, 15 April 2011

Adding an event to UIImageView Programmatically

-Now we are going to add an event to the UIImage
-By using the UITapGestureRecognizer we can able to add the event
UITapGestureRecognizer *tapGesture = [[[UITapGestureRecognizer alloc]
initWithTarget:self action:@selector(myevent:)] autorelease]; 
-Here the myevent is the function which is called after the event has occured
[image addGestureRecognizer:tapGesture];
-Set the userInteraction 
[image setUserInteractionEnabled:YES];  

No comments:

Post a Comment