问题
I have an array of tuples that is created from a JSON.
typealias TagAndLocation = (tag: String, location: String)
var resultTuples = [TagAndLocation]()
for (_, subJSON) in json {
let Tag = subJSON["Tag"].string!
let Location = subJSON["Location"].string!
let tagloc = (tag: Tag, location: Location)
resultTuples.append(tagloc)
}
Then I'll use
func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell {
let cell = UITableViewCell(style: UITableViewCellStyle.Default, reuseIdentifier: "CellConcert")
//PROBLEM IS HERE. I want the indexPath.row to be the position of the array of tupple
cell.textLabel?.text = resultTuples.[indexPath.row][]
return cell
}
Basically i want my tableView to have the content of concerts.
Any idea? Thanks
来源:https://stackoverflow.com/questions/32100734/swift2-0-create-tableview-from-an-array-of-tuples