I'm running into an odd error. This line of code functions correctly:
let cell = self.tableView.dequeueReusableCellWithIdentifier("FeedCell", forIndexPath: indexPath) as UITableViewCell!
However when I cast to FeedCell!
(a subclass of UITableViewCell
):
let cell = self.tableView.dequeueReusableCellWithIdentifier("FeedCell", forIndexPath: indexPath) as FeedCell!
Xcode throws the error: Ambiguous reference to member 'tableView'
I'm not sure how it can be ambiguous, let alone triggered by a different casting!
Try changing the line to
let cell = tableView.dequeueReusableCellWithIdentifier("FeedCell", forIndexPath: indexPath) as! FeedCell
Just remove the ! from FeedCell!
and put it in as!
and check if there is any difference.
Beside as @redent84 mentioned in his comment you should use tableView
instead of self.tableView
.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.