Er, for reference, the view hierarchy is this: http://latencyzero.com/stuff/ViewHierarchy.png
On Apr 16, 2012, at 18:16 , Rick Mann wrote: > > On Apr 16, 2012, at 16:32 , Luke Hiesterman wrote: > >> You can do this by wrapping the operation in your own animation block. This >> simple code demonstrates doing it on 44 point high rows: >> >> [UIView animateWithDuration:0.3 animations:^(void) { >> [tableView beginUpdates]; >> CGPoint contentOffset = tableView.contentOffset; >> if (contentOffset.y > 0) { >> contentOffset.y += 44; >> tableView.contentOffset = contentOffset; >> } >> [tableView insertRowsAtIndexPaths:[NSArray >> arrayWithObject:[NSIndexPath indexPathForRow:__numRows inSection:0]] >> withRowAnimation:UITableViewRowAnimationAutomatic]; >> __numRows++; >> [tableView endUpdates]; >> }]; > > Yeah, this is essentially what I do, but while I can correctly animate the > frame change alone, if I try to do that AND change contentOffset, it doesn't > work. > > Please see the following videos. For reference, the view hierarchy is this: > > http://latencyzero.com/stuff/AdjustingOffset.mov > > The parent View is a blue color. The Container view is green. The UITableView > is pink. > > If I do not adjust the content offset (that is, if it gets set to 0.0), you > can see the views move and resize correctly: > > http://latencyzero.com/stuff/AdjustingOffset.mov > > If I DO adjust the content offset (even if I hard-code it to 10 pixels), > everything ends up in the right place, but the table view immediately resizes > to the proper height, but the frame.origin.y is adjusted about 81 pixels down > in the view. It snaps to this position, THEN animates to the correct position. > > http://latencyzero.com/stuff/NoOffsetAdjustment.mov > > The code that does this (for the keyboard appearing) is here: > > http://pastebin.com/zRSR78fZ > >>> >>> 2) When animating a frame change, are subframe re-sizes also animated? It >>> looks like they're partly immediately update, then animating. >> >> Any subviews which are resized in the scope of the superview's frame change >> will share the animation, which includes anything that has autoresizing >> masks. You may need to invoke -layoutIfNeeded within your animation block on >> views who defer resizing of their subviews until layout time to capture some >> things in an animation. But that discussion is orthogonal to your stated >> goal, which can be achieved by following the sample I've provided above. > > I tried throwing in a -layoutIfNeeded, but it had no effect. > > -- > Rick > > > > > _______________________________________________ > > Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) > > Please do not post admin requests or moderator comments to the list. > Contact the moderators at cocoa-dev-admins(at)lists.apple.com > > Help/Unsubscribe/Update your Subscription: > https://lists.apple.com/mailman/options/cocoa-dev/rmann%40latencyzero.com > > This email sent to rm...@latencyzero.com _______________________________________________ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com