我正在使用UICollectionView,但找不到以下方法:
func collectionView(collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, sizeForItemAtIndexPath indexPath: NSIndexPath) -> CGSize
请建议我该如何替换它。
我正在使用UICollectionView,但找不到以下方法:
func collectionView(collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, sizeForItemAtIndexPath indexPath: NSIndexPath) -> CGSize
请建议我该如何替换它。
对于我来说,sizeForItemAt
没有被调用,因为在Swift 3中,您需要明确设置您的类实现 UICollectionViewDelegateFlowLayout
协议。
这是其新的语法:
func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, sizeForItemAt indexPath: IndexPath) -> CGSize {
}