【发布时间】:2016-02-11 15:25:20
【问题描述】:
在我更新到 Xcode 7.2 后,出现以下错误提示“下标使用不明确”:
func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell {
let cell = tableView.dequeueReusableCellWithIdentifier("Cell", forIndexPath: indexPath)
/*ERROR - Ambiguous use of subscript*/
cell.textLabel?.text = self.tvArray[indexPath.section][indexPath.row] as? String
//..... more code
}
谁能告诉我在实现 tvArray 时我做错了什么?
设置:
var tvArray = []
override func viewWillAppear(animated: Bool) {
super.viewWillAppear(true)
//..... more code
tvArray = [["Airing Today", "On The Air", "Most Popular", "Top Rated"], ["Action & Adventure", "Animation", "Comedy", "Documentary", "Drama", "Family", "Kids", "Mystery", "News", "Reality", "Sci-Fic & Fantasy", "Soap", "Talk", "War & Politics", "Western"]]
//..... more code
}
【问题讨论】:
标签: ios arrays swift swift2 ambiguous