我有tableview
我根据搜索栏的存在而向上或向下移动。运动是不稳定的,如果可能的话,我想给它制作动画。任何人都可以建议如何设置边界变化的动画?这是移动表视图的代码
CGRect newBounds = self.tableView.bounds;
newBounds.origin.y = newBounds.origin.y - self.searchBar.bounds.size.height;
self.tableView.bounds = newBounds;
答案 0 :(得分:0)
尝试使用以下代码为您的绑定更改设置动画,如果这样可以解决您的问题,请与我们联系。
CGRect newBounds = self.tableView.bounds;
[UIView animateWithDuration:1.0
delay: 0.0
options: UIViewAnimationOptionCurveEaseIn
animations:^{
newBounds.origin.y = newBounds.origin.y - self.searchBar.bounds.size.height;
self.tableView.bounds = newBounds;
}
completion:^(BOOL finished){
// do something after animation finishes.
}];