[問題] 練習實作時遇到的程式請教
在自學練習時依照課本上的程式碼
但是Xcode卻出現了錯誤
想請教板上高手給予指導
func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath:
NSIndexPath) -> UITableViewCell {
let cellIdentifier = "Cell"
let cell = tableView.dequeueReusableCellWithIdentifier(cellIdentifier,
forIndexPath: indexPath) as UITableViewCell
^^^
// Configure the cell...
cell.textLabel?.text = restaurantNames[indexPath.row]
cell.imageView?.image = UIImage(named: "restaurant")
return cell
}
Xcode建議我是不是要用as!
但是as!用了後沒出現問題但跑不出與範本一樣的結果...
想請高手給予一點指導>"<
--
※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 61.228.23.85
※ 文章網址: https://www.ptt.cc/bbs/MacDev/M.1437454667.A.548.html
→
07/21 12:59, , 1F
07/21 12:59, 1F
→
07/21 12:59, , 2F
07/21 12:59, 2F
→
07/21 13:01, , 3F
07/21 13:01, 3F
→
07/21 13:56, , 4F
07/21 13:56, 4F
推
07/21 15:36, , 5F
07/21 15:36, 5F
→
07/21 15:37, , 6F
07/21 15:37, 6F
→
07/21 15:37, , 7F
07/21 15:37, 7F
→
07/21 15:37, , 8F
07/21 15:37, 8F
→
07/21 21:48, , 9F
07/21 21:48, 9F
→
07/21 21:52, , 10F
07/21 21:52, 10F
→
07/21 21:52, , 11F
07/21 21:52, 11F
→
07/22 01:31, , 12F
07/22 01:31, 12F
→
07/22 01:32, , 13F
07/22 01:32, 13F
→
07/22 01:33, , 14F
07/22 01:33, 14F
→
07/22 01:33, , 15F
07/22 01:33, 15F
→
07/22 01:34, , 16F
07/22 01:34, 16F
感謝gradyzhuo大的說明
我後來乾脆在跑一次就解決了
當然也因為這次知道as與後來的as!是一樣的意思
至於第一次為什麼跑不出來我也搞不太懂= =
做法都沒有錯啊....
※ 編輯: MIZUYAMA (61.228.23.85), 07/22/2015 11:00:35
※ 編輯: MIZUYAMA (61.228.23.85), 07/22/2015 12:26:17
→
07/22 22:37, , 17F
07/22 22:37, 17F
→
07/22 22:37, , 18F
07/22 22:37, 18F
推
07/23 01:24, , 19F
07/23 01:24, 19F
→
07/23 01:24, , 20F
07/23 01:24, 20F
MacDev 近期熱門文章
PTT數位生活區 即時熱門文章