Question: How do you differentiate which picture is the point?
////main.m//Hello////Created by Lishujun on 14-8-28.//Copyright (c) 2014 Lishujun. All rights reserved.//#import<UIKit/UIKit.h>//View Controller Objects@interfaceHelloworldviewcontroller:uiviewcontroller@end@implementationHelloworldviewcontroller-(void) loadview{//Create a View objectUIView *contentview =[[UIView Alloc]initwithframe:[[uiscreen Mainscreen] applicationframe]; Contentview.backgroundcolor=[Uicolor Lightgraycolor]; Self.view=Contentview; Uiimageview*imageview =[[uiimageview Alloc]initwithframe:cgrectmake ( -, -, -, -)]; Imageview.image= [UIImage imagenamed:@"100.png"]; Imageview.userinteractionenabled=YES; UITapGestureRecognizer*singletap =[[UITapGestureRecognizer alloc] initwithtarget:self action: @selector (uesrclicked:)]; [ImageView Addgesturerecognizer:singletap]; Uiimageview*imageview2 =[[uiimageview Alloc]initwithframe:cgrectmake ( -, -, -, -)]; Imageview2.image= [UIImage imagenamed:@"100.png"]; Imageview2.userinteractionenabled=YES; UITapGestureRecognizer*SINGLETAP2 =[[UITapGestureRecognizer alloc] initwithtarget:self action: @selector (uesrclicked:)]; [ImageView2 ADDGESTURERECOGNIZER:SINGLETAP2]; [Contentview Addsubview:imageview]; [Contentview addsubview:imageview2];}-(void) Uesrclicked: (ID) sender{//NSLog (@ "%@", ((uiimageview*) ((UITapGestureRecognizer *) sender). View). image);NSLog (@"%@", sender);}@end//Delegate Object@interfaceHelloworldappdelegate:nsobject <UIApplicationDelegate>{iboutlet UIWindow*window;} @property (nonatomic, retain) UIWindow*window;//must be declared as a property, declared as a local variable, cannot draw a view, display as a black screen@end@implementationhelloworldappdelegate@synthesizewindow;-(void) Applicationdidfinishlaunching: (UIApplication *) application{Self.window=[[UIWindow alloc] Initwithframe:[[uiscreen Mainscreen]bounds]]; Helloworldviewcontroller*viewcontroller =[[Helloworldviewcontroller alloc]init]; Self.window.rootViewController=Viewcontroller; [Self.window makekeyandvisible];}@end//Program EntryintMainintargcChar*argv[]) {@autoreleasepool {returnUiapplicationmain (argc, argv, Nil,@"helloworldappdelegate"); }}
IOS: Images and click events