我想要为UICollectionViewCell的调整大小添加动画效果。我已经编写了下面的代码,但无法在动画块内使用return
行。有什么想法吗?
func collectionView(collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, sizeForItemAtIndexPath indexPath: NSIndexPath) -> CGSize {
var newSize = CGSize(width: (self.view.frame.width), height: 0)
UIView.animateWithDuration(2.0, animations: { () -> Void in
return newSize
})
}