2016-10-11 91 views
-5

我經歷了我工作的代碼有問題,請幫我在這件事使用未申報類型爲「CostumTableViewCell」

enter image description here

override func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell { 
    let cellIdentifier = "Cell" 
    let cell = tableView.dequeueReusableCellWithIdentifier(cellIdentifier, forIndexPath: indexPath) as CostumTableViewCell 
+0

你使用xib我認爲?如果是的話,你必須先載入xib,然後你可以像這樣申報 –

+0

clean並運行一次 –

+3

必須有一個自定義類'CostumTableViewCell'或者它只是一個錯字'Costum' vs'Custom' – vadian

回答

0

請檢查您是否包括:

1- import CostumTableViewCell

2-還必須添加問號?之後。

override func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell { 
    let cellIdentifier = "Cell" 
    let cell = tableView.dequeueReusableCellWithIdentifier(cellIdentifier, forIndexPath: indexPath) as? CostumTableViewCell 

如果不行的話試試加嗎? CostumTableViewCell之後?