これは、プレイグラウンドで正しく機能UITableView
する単純なコードです。
import UIKit
class MyDataSuorce : NSObject, UITableViewDataSource {
func tableView(tableView: UITableView!, cellForRowAtIndexPath indexPath: NSIndexPath!) -> UITableViewCell!
{
let cell = UITableViewCell(style: .Value2, reuseIdentifier: nil)
cell.textLabel.text = "Row #\(indexPath.row)"
return cell;
}
func tableView(tableView: UITableView!, numberOfRowsInSection section: Int) -> Int
{
return 4
}
}
let list = UITableView(frame:CGRectMake(0,0,300,300), style: .Plain)
let d = MyDataSuorce()
list.dataSource = d
list.reloadData()
しかし、私が最初にこのコードを試したとき、それは機能せず、空のUITableView
.
let list = UITableView(frame:CGRectMake(0,0,300,300), style: .Plain)
list.dataSource = MyDataSuorce()
list.reloadData()
2 番目のコードの何が問題になっていますか?
編集:
これは のコンソール出力ですlist.dataSource = MyDataSuorce()
:
プレイグラウンドの実行に失敗しました: エラー: エラー: シンボルを検索できませんでした: _memmove