1
我更新到7.2的Xcode後錯誤彈出說「曖昧使用的下標」在下面:曖昧使用標使用[indexPath.section] [indexPath.row]
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
}
謝謝,我想我忘了那部分。奇怪的是編譯器沒有在7.1中抱怨:0 – Mat0
編譯器也在學習;-) – vadian