[英]Animating UITableView resize
Im using the following code to animate the resizing of a UITableView
to make way for a UIView
with extra controls when the UITableView.isEditing. 我使用以下代码来动画调整UITableView
的大小,以便在UITableView.isEditing时为具有额外控件的UIView
让路。
[UIView animateWithDuration:3 // 0.2 but slowed down to easily see difference
delay:0
options:UIViewAnimationOptionCurveEaseOut
animations:^{
[self.selectControlsView setFrame:CGRectMake(0, self.tableView.frame.size.height-self.selectControlsView.frame.size.height, self.selectControlsView.frame.size.width, self.selectControlsView.frame.size.height)];
[self.tableView setFrame:CGRectMake(0, 0, self.tableView.frame.size.width, self.tableView.frame.size.height-self.selectControlsView.frame.size.height)];
}
completion:nil];
This works fine except it seems the UITableView
animates faster than the UIView
does (even though I adjust the UIViews frame before the UITableViews
frame), causing a black flicker during the animation from the background. 这样工作正常,但看起来UITableView
动画效果比UIView
更快(即使我在UITableViews
帧之前调整UIViews帧),在动画期间从背景中产生黑色闪烁。
Is there a way to animate the two views in tandem? 有没有办法同时动画两个视图?
The problem was caused because the controller was a subclass of UITableViewController. 问题是由于控制器是UITableViewController的子类引起的。 I'm now subclassing UIViewController and adding the UITableView as a subview, the animation for adding the new view and resizing the UITableView now works as expected. 我现在正在继承UIViewController并将UITableView添加为子视图,添加新视图和调整UITableView大小的动画现在可以按预期工作。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.