ios - Delete function doesn't works when animation begins ? -


i trying implement ,long press , delete functionality of apple, myself.

i achieved but, there not figure out.

when shaking animation starts delete button not take touches.

how handle while shaking deleting view.

here code;

    self.frame = cgrectmake(0, 0, 1024, 768);      [self setbackgroundcolor:[[uicolor blackcolor] colorwithalphacomponent:0.8]];       circleview = [[uiview alloc] initwithframe:cgrectmake(50,55,90,90)];     circleview.layer.cornerradius = 45;      circleview.backgroundcolor = [[uicolor whitecolor] colorwithalphacomponent:1];     circleview.layer.bordercolor = [[uicolor blackcolor] cgcolor];     circleview.layer.borderwidth = 4;      uilabel* circleindex = [[uilabel alloc] init];     circleindex.frame    = cgrectmake(30, 25, 40, 40);     [circleindex setfont:[uifont fontwithname:@"arial-boldmt" size:40]];     [circleindex settext:@"a"];      [circleview addsubview:circleindex];        uiview *exitview = [[uiview alloc] initwithframe:cgrectmake(78,5,20,20)];     exitview.layer.cornerradius = 10;      exitview.backgroundcolor = [[uicolor redcolor] colorwithalphacomponent:1];     exitview.layer.bordercolor = [[uicolor whitecolor] cgcolor];     exitview.layer.borderwidth = 2;      uilabel* exitlabel = [[uilabel alloc] init];     exitlabel.frame    = cgrectmake(5, 0.5, 25, 20);     [exitlabel setfont:[uifont fontwithname:@"arial-boldmt" size:25]];     [exitlabel settextcolor:[uicolor whitecolor]];     [exitlabel setbackgroundcolor:[uicolor clearcolor]];     [exitlabel settext:@"-"];      [exitview addsubview:exitlabel];       [circleview addsubview:exitview];      uiview *alertview  = [[uiview alloc]initwithframe:cgrectmake(40, 80, 944, 600)];              [exitview setuserinteractionenabled:yes];       uilongpressgesturerecognizer *longpress =     [[uilongpressgesturerecognizer alloc] initwithtarget:self                                                   action:@selector(handlelongpress:)];     [circleview addgesturerecognizer:longpress];       uitapgesturerecognizer *singlepress =     [[uitapgesturerecognizer alloc] initwithtarget:self                                                   action:@selector(handlesinglepress:)];     [exitview addgesturerecognizer:singlepress];     //[longpress release];      [circleview bringsubviewtofront:exitview];      [alertview addsubview:circleview];      [self addsubview:alertview];  } return self; }     //the event handling method - (void)handlelongpress:(uilongpressgesturerecognizer *)recognizer{ //cgpoint location = [recognizer locationinview:[recognizer.view superview]]; if ( recognizer.state == uigesturerecognizerstateended ) {      //[circleview removefromsuperview];      [self shakeview:recognizer.view]; }    }  - (void)handlesinglepress:(uitapgesturerecognizer *)recognizer{ //cgpoint location = [recognizer locationinview:[recognizer.view superview]]; if ( recognizer.state == uigesturerecognizerstateended ) {      [recognizer.view.superview removefromsuperview];      }    }    - (void)shakeview:(uiview *)viewtoshake   { cgfloat t = 2.0; cgaffinetransform translateright  = cgaffinetransformtranslate(cgaffinetransformidentity, t, 0.0); cgaffinetransform translateleft = cgaffinetransformtranslate(cgaffinetransformidentity, -t, 0.0);  viewtoshake.transform = translateleft;  [uiview animatewithduration:0.07 delay:0.0 options:uiviewanimationoptionautoreverse|uiviewanimationoptionrepeat animations:^{     [uiview setanimationrepeatcount:200.0];     viewtoshake.transform = translateright; } completion:^(bool finished) {     if (finished) {         [uiview animatewithduration:0.05 delay:0.0 options:uiviewanimationoptionbeginfromcurrentstate animations:^{             viewtoshake.transform = cgaffinetransformidentity;         } completion:null];     } }]; } 

use in options parameter of animation uiviewanimationoptionallowuserinteraction


Comments

Popular posts from this blog

javascript - Laravel datatable invalid JSON response -

java - Exception in thread "main" org.springframework.context.ApplicationContextException: Unable to start embedded container; -

sql server 2008 - My Sql Code Get An Error Of Msg 245, Level 16, State 1, Line 1 Conversion failed when converting the varchar value '8:45 AM' to data type int -