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.
解决方法 没有理由将IndexPath转换为NSIndexPath.Swift 3覆盖类型IndexPath具有属性
/// 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中所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)