大佬教程收集整理的这篇文章主要介绍了ios – NSIndexPath和IndexPath在Swift 3.0中,大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。
func collectionView(_ collectionView: UICollectionView,cellForItemAt indexPath: IndexPath) -> UICollectionViewCell { let cell : NNAmenitiesOrFurnishingCollectionViewCell = self.amenitiesOrFurnishingCollectionView.dequeueReusableCell(withReusEIDentifier: "NNAmenitiesOrFurnishingCollectionViewCell",for: indexPath) as! NNAmenitiesOrFurnishingCollectionViewCell cell.facilityImagename = self.facilityArraY[(indexPath as NSIndexPath).row].imagename cell.facilityLabelString = self.facilityArraY[(indexPath as NSIndexPath).row].labelText return cell }
任何人都可以告诉我为什么indexPath被转换为NSIndexPath.
/// The section of this index path,when used with `UITableView`. /// /// - precondition: The index path must have exactly two elements. public var section: Int /// The row of this index path,when used with `UITableView`. /// /// - precondition: The index path must have exactly two elements. public var row: Int
您可以直接访问:
cell.facilityImagename = self.facilityArraY[indexPath.row].imagename cell.facilityLabelString = self.facilityArraY[indexPath.row].labelText
显然,Xcode迁移者并不完美.
以上是大佬教程为你收集整理的ios – NSIndexPath和IndexPath在Swift 3.0中全部内容,希望文章能够帮你解决ios – NSIndexPath和IndexPath在Swift 3.0中所遇到的程序开发问题。
如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。
本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。