objective c - UIButton rotation animation not rotating back with CGAffineTransformMakeRotation -


i have button (openmenu) animating down (works fine) , rotate (works first time) "drawer". first time rotates works.. when try rotate again wigs out , hides image , shows button title? ideas of why? need rotate 45 degrees. don't know why this.

also - see gif image below see happening.

- (void)viewdidload {      [super viewdidload];      draw1 = 0;     scrollview.frame = cgrectmake(0, -200, 768, 200);     [scrollview setcontentsize:cgsizemake(768, 200)];     openmenu.frame = cgrectmake(680, 100, 55, 55);  }     - (ibaction)openmenu:(id)sender {      if (draw1 == 0) {          draw1 = 1;          cgrect optionsdrawer = scrollview.frame;         cgrect optionsbutton = openmenu.frame;         optionsdrawer.origin.y += 200;         optionsbutton.origin.y += 200;         [uiview animatewithduration:0.5                          animations:^{                              scrollview.frame = optionsdrawer;                              openmenu.frame = optionsbutton;                              openmenu.transform = cgaffinetransformmakerotation(degrees_to_radians(45));                          }];     } else {          draw1 = 0;          cgrect optionsdrawer = scrollview.frame;         cgrect optionsbutton = openmenu.frame;         optionsdrawer.origin.y -= 200;         optionsbutton.origin.y -= 200;         [uiview animatewithduration:0.5                          animations:^{                              scrollview.frame = optionsdrawer;                              openmenu.frame = optionsbutton;                              openmenu.transform = cgaffinetransformmakerotation(degrees_to_radians(45));                          }];     }  } 

do this, using layers animate, easy, once u rotate, dont need rotate again, brings original state. did works me, try this. since using layers add "quartzcore" library , import


 #import<quartzcore/quartzcore.h> //include   if (draw1 == 0)   {      ....//your code     [uiview animatewithduration:0.1 animations:^{      detailbutton.layer.transform = catransform3dmakerotation((180) * 45, 0, 0, 1);  }];   }   else  {   ....//your code     [uiview animatewithduration:0.1 animations:^{     detailbutton.transform = cgaffinetransformidentity; //brings original position animating }];   } 


hope helps u :)


Comments

Popular posts from this blog

How to remove text and logo OR add Overflow on Android ActionBar using AppCompat on API 8? -

html - How to style widget with post count different than without post count -

url rewriting - How to redirect a http POST with urlrewritefilter -