IOS:矩形保持tableview边界的图像变化

时间:2016-09-10 16:58:30

标签: ios animation tableview

我有tableview我根据搜索栏的存在而向上或向下移动。运动是不稳定的,如果可能的话,我想给它制作动画。任何人都可以建议如何设置边界变化的动画?这是移动表视图的代码

CGRect newBounds = self.tableView.bounds;
   newBounds.origin.y = newBounds.origin.y - self.searchBar.bounds.size.height;
   self.tableView.bounds = newBounds;

1 个答案:

答案 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. 

            }];