UIButton Double-click event response

Source: Internet
Author: User
Tags allkeys touch
Touch time
NSDateFormatter * formatter = [[[[NSDateFormatter alloc] init] autorelease];
[Formatter setdateformat:@ "yymmddhhmmsssss"]; Accurate to milliseconds
NSString *date = [formatter stringfromdate:[nsdate date]];

Nsarray * Btnarray = [M_twobtndic AllKeys];

Store Last Touch
if ([[[M_twobtndic Objectforkey:[btnarray objectatindex:0]] isequal: @ "BTN1"])
{
[M_twobtndic Removeobjectforkey:[btnarray objectatindex:0];
[M_twobtndic setobject:[nsstring stringwithformat:@ "%d", Btn.tag] forkey:[nsstring stringwithformat:@ "%lf", [date Doublevalue]];
}
Else
{
if ([[[M_twobtndic Objectforkey:[btnarray objectatindex:0]] isequal: @ "BTN2"])
{
[M_twobtndic Removeobjectforkey:[btnarray objectatindex:[self Minindexofarray:btnarray]];
[M_twobtndic setobject:[nsstring stringwithformat:@ "%d", Btn.tag] forkey:[nsstring stringwithformat:@ "%lf", [date Doublevalue]];
}
Else
{
[M_twobtndic Removeobjectforkey:[btnarray objectatindex:[self Minindexofarray:btnarray]];
[M_twobtndic setobject:[nsstring stringwithformat:@ "%d", Btn.tag] forkey:[nsstring stringwithformat:@ "%lf", [date Doublevalue]];
}
}

Nsarray *btnarray2 = [M_twobtndic AllKeys];
NSString *str1 = [BtnArray2 objectatindex:0];
NSString *STR2 = [BtnArray2 objectatindex:1];

if ([[M_twobtndic OBJECTFORKEY:STR1] isequal: [M_twobtndic objectforkey:str2]] && FABSF ([str1 Doublevalue]-[St R2 Doublevalue]) < 1000)
{
[Self performselector: @selector (detectbtncolor:) withobject:btn afterdelay:0.1];
if (M_drawcolorviewwithshadow.hidden = = YES)
{
M_drawcolorviewwithshadow.hidden = NO;
}
}
Else
{
M_bchangefavouratebrushcolorflag = NO;
}

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.