ios - Get data from custom cell to TableViewController -


i have uitextfield in custom uitableviewcell, , need input text uitableviewcontroller, when press button. code:

class dotextfieldtableviewcell: uitableviewcell {     @iboutlet weak var textfield: uitextfield!     override func setselected(selected: bool, animated: bool) {         super.setselected(selected, animated: animated)     } }  class newtodotableviewcontroller: uitableviewcontroller {     @ibaction func createtodo(sender: anyobject) {         self.dismissviewcontrolleranimated(true, completion: nil)     } } 

just use method , cast cell class dotextfieldtableviewcell

override func tableview(tableview: uitableview, cellforrowatindexpath indexpath: nsindexpath) -> uitableviewcell {     let cell = tableview.dequeuereusablecellwithidentifier("reuseidentifier", forindexpath: indexpath) as! dotextfieldtableviewcell      // configure cell...      return cell } 

and after can use

let sometext = cell.textfield.text 

Comments