IOS UIButton Single-click to process responses in different ways

Source: Internet
Author: User

  //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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.