1
我想知道我是否走向正確的方向。表視圖單元格接受文本輸入?
我試圖建立一個用戶將輸入數據的窗體(見截圖)。
我已經建立了一個表格視圖,但我不確定如何接受來自用戶的數據輸入。沒有找到任何教程。他們大多從文本字段開始。
任何人的意見?
感謝,
朱利安
我想知道我是否走向正確的方向。表視圖單元格接受文本輸入?
我試圖建立一個用戶將輸入數據的窗體(見截圖)。
我已經建立了一個表格視圖,但我不確定如何接受來自用戶的數據輸入。沒有找到任何教程。他們大多從文本字段開始。
任何人的意見?
感謝,
朱利安
是的,從你的UI看,有tableView
是正確的。您應該創建一個自定義UITableViewCell
,其UITextField
爲IBOutlet
。
事情是這樣的:
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
}
如果需要的話,你甚至可以在一個CustomTableViewCell
和configure()
在更新的cellForRowAtIndexPath
或text
placeholder
。
感謝您的幫助! –
看看[Eureka](https://github.com/xmartlabs/Eureka) – vadian
謝謝,看看:) –