i'm playing ios 6 autolayout first time , i'm trying figure out how mix autolayout , animation.
i've got container view, viewa, height. i've got uidatepicker, viewb, 216 tall , has constraint sets vertical space between viewa , viewb = 0, viewb pinned bottom of viewa.
i want animate viewa's height make smaller , have viewb remain pegged bottom of viewa entire time.
[uiview animatewithduration:2.0 animations:^{ cgrect containerframe = self.tablecontainerview.frame; containerframe.size.height -= self.datepicker.frame.size.height; self.tablecontainerview.frame = containerframe; } completion:^(bool finished) { nslog(@"done"); }];
viewa, container view, shorter intended, viewb not follow along.
how can constraints between viewa , viewb automatically adjust viewb's position during animation?
it looks constraints, should work. problem might way animation. should constraints, not frames. if viewa has constraint bottom of superview, can animate constant of constraint. make iboutlet bottom constraint, , (bottomcon outlet in example):
self.bottomcon.constant = self.datepicker.bounds.size.height; [uiview animatewithduration:2.0 animations:^{ [self.view layoutsubviews]; [self.containerview layoutsubviews]; } completion:^(bool finished) { nslog(@"done"); }];
in edit, added [self.containerview layoutsubviews] line. necessary subviews updated (otherwise jump new location).
Comments
Post a Comment