這裏是我的斯威夫特2代碼:曖昧參考成員「下標」
func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell {
var cell: UITableViewCell!
cell = tableView.dequeueReusableCellwithIdentifier: forWithIdentifier("idCellChannel", forIndexPath: indexPath as IndexPath)
let channelTitleLabel = cell.viewWithTag(10) as! UILabel
let thumbnailImageView = cell.viewWithTag(12) as! UIImageView
let channelDetails = channelsDataArray[indexPath.row]
channelTitleLabel.text = channelDetails["title"] as? String
// Error Ambiguous reference to member 'subscript'
thumbnailImageView.image = UIImage(data: NSData(contentsOfURL: NSURL(string: (channelDetails["thumbnail"] as? String)!)!)!)
return cell
}
請給我一個解決方案,斯威夫特3.
嘗試用'let channelDetails = channelsDataArray [indexPath.row] as! Dictionary –
請用'channelsDataArray'聲明更新您的問題。 – rmaddy
還要說明哪一行實際上是在給出錯誤。您的錯誤評論是否適用於該行之前或之後的行? – rmaddy