iphone - Animate resizing UIView header of UITableView -
basically, want replicate behavior in login screen in facebook iphone: when input field touched, logo/header view decreases in height make room keyboard.
here have uitableview (with static content):

the "control" uiview have contains logo in uiimageview, , "table view section" contains uitextfields username/password.
my question is, how can animate having uiview ("control") decreasing height, while having uitableviewcells in "table view section" naturally slide up? have tried following:
[uiview animatewithduration:1.0f animations:^{ cgrect theframe = _headerview.frame; theframe.size.height -= 50.f; _headerview.frame = theframe; }]; where _headerview uiview header. resized, uitableview not react if uitableviewcell resized (i.e. login uitableviewcells don't shift up). how can fix this?
i have seen examples of how resize uitableviewcell, can't put header/logo in uitableviewcell table view section grouped , shouldn't login section.
edit
great answer! here's how ended animating it, view_is_up instance variable:
-(void)movetableview:(bool)up{ float move_distance = 55.f; [uiview beginanimations:nil context:nil]; [uiview setanimationduration:.3f]; [uiview setanimationcurve:uiviewanimationcurveeaseout]; uiedgeinsets insets = self.tableview.contentinset; if(view_is_up&&!up){ insets.top += move_distance; view_is_up = no; } else if(!view_is_up&&up){ insets.top -= move_distance; view_is_up = yes; } self.tableview.contentinset = insets; [uiview commitanimations]; } it works beautifully, , configurable via uiview animations.
if add following code in animations' block, should fix it:
uiedgeinsets insets = self.tableview.contentinset; insets.top -= 50.f; self.tableview.contentinset = insets; where self.tableview outlet uitableview
Comments
Post a Comment