我正在制作一个非常简单的应用程序,在第一个屏幕上,用户输入人数。
在第二个屏幕上,根据用户在第一个屏幕中输入的数字生成一些
我该怎么做?谢谢!
编辑:我正在使用故事板。
这是调用我的
在第二个屏幕上,根据用户在第一个屏幕中输入的数字生成一些
UITableViewCell
。这些UITableViewCell
中有一个UITextField
,我正在尝试一旦用户点击转到第三个屏幕,就将输入在这些字段中的数据存储到数组中。我该怎么做?谢谢!
编辑:我正在使用故事板。
这是调用我的
UIViewController
的自定义UITableViewCell
的代码样子:func tableView(tableView:UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell{
var cell: EditingCell = tableView.dequeueReusableCellWithIdentifier("Cell") as EditingCell
if indexPath.row % 2 == 0{
cell.backgroundColor = UIColor.purpleColor()
} else {
cell.backgroundColor = UIColor.orangeColor()
}
let person = arrayOfPeople[indexPath.row]
cell.setCell(person.name)
return cell
}
这是UITableViewCell
的代码:
class EditingCell: UITableViewCell{
@IBOutlet weak var nameInput: UITextField!
override func awakeFromNib() {
super.awakeFromNib()
// Initialization code
}
override func setSelected(selected: Bool, animated: Bool) {
super.setSelected(selected, animated: animated)
// Configure the view for the selected state
}
func setCell(name:String){
self.nameInput.placeholder = name
}
}