【发布时间】:2017-05-13 06:04:14
【问题描述】:
我搜索了关于成员“下标”的模糊引用,但找不到任何解决方案。我正在使用表视图。这是我正在使用的代码:-
let people = [
["Pankaj Negi" , "Rishikesh"],
["Neeraj Amoli" , "Dehradun"],
["Ajay" , "Delhi"]
];
// return the number of section
func numberOfSections(in tableView: UITableView) -> Int {
return 1;
}
// return how many row
func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return people.count;
}
// what are the content of the cell
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let cell = UITableViewCell();
var (personName , personLocation) = people[indexPath.row] // Ambiguous Reference to member 'subscript'
cell.textLabel?.text = personName;
return cell;
}
我是 IOS 开发的新手,为什么我很难理解这一点。但是这段代码在 Xcode 6 中有效,但在 Xcode 8 中无效。为什么我不知道?
【问题讨论】: