ios - Objective-C - Animate button with blocks? -
i have uiscrollview , uibutton. using blocks animate them button won't animate while uiscrollview does? can not animate button this?
any appreciated greatly!
- (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; [uiview animatewithduration:0.5 animations:^{ scrollview.frame = optionsdrawer; openmenu.frame = optionsbutton; }]; } else { draw1 = 0; cgrect optionsdrawer = scrollview.frame; cgrect optionsbutton = openmenu.frame; optionsdrawer.origin.y -= 200; [uiview animatewithduration:0.5 animations:^{ scrollview.frame = optionsdrawer; openmenu.frame = optionsbutton; }]; } }
ah! forgot add origin button well! oops!
fixed adding each:
optionsbutton.origin.y += 200;
Comments
Post a Comment