我遇到了一個奇怪的錯誤。這行代碼正常工作:當使隊列出隊時對成員'tableView'的歧義引用
let cell = self.tableView.dequeueReusableCellWithIdentifier("FeedCell", forIndexPath: indexPath) as UITableViewCell!
然而,當我轉換爲FeedCell!
(的UITableViewCell
一個子類):
let cell = self.tableView.dequeueReusableCellWithIdentifier("FeedCell", forIndexPath: indexPath) as FeedCell!
Xcode中引發錯誤:Ambiguous reference to member 'tableView'
我不知道怎麼樣它可能是模棱兩可的,更不用說由不同的角色觸發了!
請檢查http://stackoverflow.com/a/33724276/5362916 –
我檢查了這一點 - 但我使用的是UITableViewController而不是UIViewController的子類。創建一個名爲'tableView'的IBOutlet只是衝突。 此外,爲什麼會由我投射到不同的細胞子類觸發? – jonlambert
您可能從已將'tableView'作爲參數的'UITableViewControllerDataSource'方法調用此方法。嘗試將'self.tableView'更改爲'tableView'。 – redent84