cocoa touch - Animate UIView — objective-c -
i have uibutton, , when it's pressed uiview expands down button. view first set to:
cgrectmake(0, (button.frame.orgin.y+button.frame.size.hight), self.view.frame.size.width, 0);
then when button pressed hight expands:
cgrectmake(0, (button.frame.orgin.y+button.frame.size.hight), self.view.frame.size.width, 200);
when view expanded , button pressed again view collapsed again height of 0. have animated of [uiview beginanimation:nil context:null]...;
not specified animationtransition or curve.
my problem animation isn't want. becomes tinier , tinier during animation, make sense since height changed.
my question how can change animation , make view travels behind button, without being pushed together. — when it's pressed second time collapse.
please ask if question unclear thanks!
i think want animate y
origin of frame , keep height same before , after animation. change first code (the 1 before animation) to:
cgrectmake(0, button.frame.origin.y, self.view.frame.size.width, 200);
or if want make use of cgrect methods:
cgrectmake(0, cgrectgetminy(button.frame), cgrectgetwidth(self.view.frame), 200);
and see if give result want.
it use animatewithduration block-based method:
[uiview animatewithduration:duration animations:^{ cgrectmake(0, cgrectgetmaxy(button.frame), cgrectgetwidth(self.view.frame), 200); }];
Comments
Post a Comment