2016-08-21 22 views
1

我想知道我是否走向正確的方向。表視圖單元格接受文本輸入?

我試圖建立一個用戶將輸入數據的窗體(見截圖)。

我已經建立了一個表格視圖,但我不確定如何接受來自用戶的數據輸入。沒有找到任何教程。他們大多從文本字段開始。

任何人的意見?

Image of user interface layout

感謝,

朱利安

+0

看看[Eureka](https://github.com/xmartlabs/Eureka) – vadian

+0

謝謝,看看:) –

回答

0

是的,從你的UI看,有tableView是正確的。您應該創建一個自定義UITableViewCell,其UITextFieldIBOutlet

事情是這樣的:

class CustomTableViewCell: UITableViewCell{ 
    @IBOutlet weak var textField: UITextField! 
} 

然後實現UITableViewDatasource

public func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell { 
    let cell = tableView.dequeueReusableCellWithIdentifier("CustomCell") as! CustomTableViewCell 

    return cell 
} 

如果需要的話,你甚至可以在一個CustomTableViewCellconfigure()在更新的cellForRowAtIndexPathtextplaceholder

+0

感謝您的幫助! –

相關問題