【问题标题】:IOS how to animate first cell of UICollectionView to slide in from rightIOS如何为UICollectionView的第一个单元格设置动画以从右侧滑入
【发布时间】:2014-01-20 17:34:21
【问题描述】:

我在视图控制器中设置了一个简单的 UICollectionView“pictureColectionView”。 PicturesVC允许用户在collectionview中滑动浏览图片。

客户希望我添加动画,以便在视图控制器出现时第一张图片从左向右“滑入”。 PictureVC的布局如下:

问题是:我应该在哪里添加动画?

【问题讨论】:

  • UICollectionView 不应该这样做。幻灯片效果已经编码为滚动 owl 集合。

标签: ios animation uicollectionview


【解决方案1】:

我只是想把它添加到 PicturesVC viewDidAppear 中,它起作用了!

int index_start = -1;
int index_finish = 0;
CGFloat dx_start = index_start*960;
CGFloat dx_finish =index_finish*960;

[self.collectionView setContentOffset:CGPointMake(dx_start, 0) animated:animated];


[UIView animateWithDuration:0.67 animations:
 ^{
     // Animate the views on and off the screen. This will appear to slide.
     [self.collectionView setContentOffset:CGPointMake(dx_finish, 0) animated:animated];

 }
 completion:^(BOOL finished)
 {
     if (finished)
     {


     }
 }];

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2016-01-12
    • 2018-08-22
    • 1970-01-01
    • 1970-01-01
    • 2013-07-17
    • 2021-07-04
    • 1970-01-01
    相关资源
    最近更新 更多