在我转换到swift 3期间,在尝试从我的分析数据库中定义标签的文本时遇到错误。这里就是我定义我的手机验证码:Swift 3没有下标错误
let cell = collectionView.dequeueReusableCell(withReuseIdentifier: "ExpandCell", for: indexPath) as! ExpandingCollectionViewCell
let object = self.imageFilesArray[(indexPath as NSIndexPath).row]
cell.nameLabel.text = String(describing: object["name"]).uppercased()
return cell
就行了“cell.nameLabel.text ......”我得到一个错误,说明“中键入任何没有标成员。”我搜遍了各地,发现有类似的问题,但没有人能够帮助我。有没有人有什么建议?
编辑:这里是我定义imageFilesArray代码:
let query = PFQuery(className: "Events")
query.order(byAscending: "dateString")
query.findObjectsInBackground{
(objects, error) -> Void in
if error == nil {
self.imageFilesArray = objects! as NSArray
无关你的问题,但并不需要投给NSIndexPath:http://stackoverflow.com/questions/39631905/nsindexpath-and-indexpath-in-swift-3- 0。 –
什么是self.imageFilesArray数组? –
他们是来自解析的PFObjects – user3255746