阵列产品型号detail models
我的代码:
productDetailsNameLabel.text = products[indexPath.section].arr_details?[indexPath.item].productname
获取错误信息:
Type Arr_Details has no subscripts member
最佳答案
arr_details 没有任何下标成员,因此您无法访问它。请引用以下示例:
class Abc: NSObject {
var arr: [Xyz] = []
override init() {
for i in 1...5 {
arr.append(Xyz(number: i))
}
}
}
class Xyz: NSObject {
var number: Int
init(number: Int) {
self.number = number
}
}
// Use of this class
var arrAbc: [Abc] = []
for _ in 0...5 {
arrAbc.append(Abc())
}
yourLabel.text = "\(arrAbc[0].arr[0].number)"
关于ios - 如何从给定图像访问 Json 数据,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51437117/