0
'subscript'에 대한 검색에 대한 모호한 참조 정보가 있는데 해결책을 찾을 수 없습니다. 나는 TableView를 사용하고있다. 이것이 내가 사용하고있는 코드입니다 : -Xcode 8의 'subscript'멤버에 대한 모호한 참조
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;
}
나는 이것이 왜 이해가 안되는가하는 이유는 무엇입니까? 그러나이 코드는 Xcode 6에서 작동하지만 Xcode 8에서는 작동하지 않습니다. 왜 내가 모를까요?
감사합니다. @Nirav D, 2 차원 배열을 만들었지 만 튜플 배열이 필요합니다.이 경우이 오류가 표시됩니다. '('대신 '['를 사용하는 것은 내 옆에서 어리석은 실수입니다. –