Uiimageview gesture handling can respond to click events.
1. self.allScreenImg.userInteractionEnabled = Yes;//uiimageview does not respond to gestures by default and needs to be turned on userinteractionenabled
Handling Click events
uitapgesturerecognizer* Singletap = [[UITapGestureRecognizer alloc] initwithtarget:self action: @selector ( Clickallscreen:)];
[Self.allscreenimg Addgesturerecognizer:singletap];
2. How to add a process
-(void) Clickallscreen: (UITapGestureRecognizer *) Recognizer {
allscreenviewcontroller* Recordviewcontroller = [[Allscreenviewcontroller alloc] initwithstoryboard];
[Self.navigationcontroller Pushviewcontroller:recordviewcontroller Animated:yes];
}
The above can be done in response to the Uiimageview click event.
Method Two:
Set tag for Uiimageview to process gestures directly to handle click events:
Imageview.settag = 333;
-(void) Touchesbegan: (Nsset *) touches withevent: (Uievent *) Event {
uiimageview* img = (Uiimageview *) [Self.view viewwithtag:333];
if (IMG) {
TODO some thing
}
}
Reference Blog: http://www.tekuba.net/program/274/
This article is from the "Sheep" blog, please make sure to keep this source http://5934497.blog.51cto.com/5924497/1633896
Workarounds for IOS Uiimageview Direct response to click events