I am using the below code to display MyEditViewController
but all the field outlets in MyEditViewController
are nil because of this line let editController = MyEditViewController()
. Here I am creating new instance. So outlets are nil now. Is there any other way to call the edit controller without creating instance of it?
@IBAction func editMethod(sender: UILongPressGestureRecognizer) {
if sender.state == UIGestureRecognizerState.Began {
let cell = sender.view as! MyTableViewCell
let editController = MyEditViewController()
editController.sample= samples[cell.tag]
presentViewController(editController, animated: true, completion: nil)
}
}