【发布时间】:2015-02-13 20:44:33
【问题描述】:
我正在使用自定义 UICollectionview 布局,以圆形显示项目。在向上滑动时,我重置了我的 collectionview 上的约束并为这些约束更改设置动画。我希望我的项目随着约束的变化而动画化,所以这是一种流畅的体验。
我让它们制作动画,但只有在约束更改之后(我认为),它看起来又乱又奇怪,请在此处查看截屏视频:http://cl.ly/ZmA0
这是滑动手势方法中的代码:
- (void)foo:(UISwipeGestureRecognizer *)gesture {
[self.view layoutIfNeeded];
[self.collectionView mas_remakeConstraints:^(MASConstraintMaker *make) {
make.width.equalTo(self.view.mas_width);
make.height.equalTo(self.collectionView.mas_width);
make.top.equalTo(self.view.mas_top).offset(50);
}];
[UIView animateWithDuration:1.0 animations:^{
[self.view layoutIfNeeded];
}];
[self.collectionView performBatchUpdates:^{
CircleLayout *layout = (CircleLayout *)self.collectionView.collectionViewLayout;
} completion:nil];
}
有什么建议吗?
【问题讨论】:
标签: ios objective-c animation uicollectionview