//Show target double-click to display the current user coordinate locationUIButton * btnshowdistination = [[UIButton alloc]initwithframe:cgrectmake ( the, screen_height- the- -, *, *)]; [Btnshowdistination setbackgroundimage:[uiimage imagenamed:@"show_distination"] Forstate:uicontrolstatenormal]; [Btnshowdistination addtarget:self Action: @selector (btntouchone:forevent:) forControlEvents: Uicontroleventtouchdown]; [Btnshowdistination addtarget:self Action: @selector (buttonrepeataction:) forControlEvents: Uicontroleventtouchdownrepeat]; [Self.view addsubview:btnshowdistination]; }- (void) Btntouchone: (UIButton *) sender forevent: (Uievent *)Event{[Self performselector: @selector (showdistination:) withobject:sender afterdelay:0.3];}- (void) Buttonrepeataction: (UIButton *) sender{[nsobject cancelpreviousperformrequestswithtarget:self selector: @selector (showdistination:)Object: sender]; [Self showsuserlocation:sender];}- (void) Showsuserlocation: (UIButton *) sender{if(_mapview.userlocation) {[_mapview setcentercoordinate:_mapview.userlocation.coordinate Animated:YES]; _mapview.zoomlevel= -; }}- (void) Showdistination: (UIButton *) sender{if(_circle) {[_mapview setcentercoordinate:_circle.coordinate animated:no]; _mapview.zoomlevel= -; } }
IOS UIButton Single-click to process responses in different ways