我正在尝试像这样扩展我的视图:
CGRect endFrame = self.detailView.bounds;
[UIView animateWithDuration:0.25 animations:^{
self.descriptionButton.bounds = endFrame;
}completion:^(BOOL finished) {
self.containerView.alpha = 0.0;
self.detailView.alpha = 1.0;
}];
我的 detailView 是容器视图。我的描述按钮在左上角。我想通过让按钮占据整个屏幕来提供放大效果。但是,默认情况下,Core Animation 从其中心的锚点缩放。
我尝试将锚点设置为视图图层的右下角,如下所示:
self.descriptionButton.layer.anchorPoint = CGPointMake(self.descriptionButton.bounds.size.width, self.descriptionButton.bounds.size.height);
CGRect endFrame = self.detailView.bounds;
[UIView animateWithDuration:0.25 animations:^{
self.descriptionButton.bounds = endFrame;
}completion:^(BOOL finished) {
self.containerView.alpha = 0.0;
self.detailView.alpha = 1.0;
}];
但是当我这样做时,我根本看不到任何动画。有什么想法吗?谢谢。