-5
我在Xcode 6用客觀的C代碼的UITableView,但我想取代我的目標C代碼迅速語言UITableView的使用迅速語言
我在Xcode 6用客觀的C代碼的UITableView,但我想取代我的目標C代碼迅速語言UITableView的使用迅速語言
複製並從默認UITableViewController
子模板粘貼(文件>新建>文件> iOS版>源>可可觸摸類>設置超到UITableViewController
):
override func numberOfSectionsInTableView(tableView: UITableView!) -> Int {
// #warning Potentially incomplete method implementation.
// Return the number of sections.
return 0
}
override func tableView(tableView: UITableView!, numberOfRowsInSection section: Int) -> Int {
// #warning Incomplete method implementation.
// Return the number of rows in the section.
return 0
}
override func tableView(tableView: UITableView!, cellForRowAtIndexPath indexPath: NSIndexPath!) -> UITableViewCell! {
let cell = tableView.dequeueReusableCellWithIdentifier("reuseIdentifier", forIndexPath: indexPath) as UITableViewCell
// Configure the cell...
return cell
}
創建的UITableViewController
在斯威夫特文件中的子類和代碼適應您的需求。
你在Swift代碼上的嘗試在哪裏?這不是一個爲您編寫代碼的網站。 – zaph 2014-10-02 12:09:59
如果您在Swift中創建'UITableViewController'的子類,則大部分代碼都會自動爲您創建。還有@Zaph提到的,告訴我們你到目前爲止所嘗試過的,我們可以幫助你。 – Isuru 2014-10-02 12:13:41
也許這將是學習Swift的好機會? – 2014-10-02 12:15:46