Scroll through this menu in ViewController A
let AddMenuItem = UIMenu(title: "", options: .displayInline, children: [
UIAction(title: "new folder", image: UIImage(systemName: "folder.fill.badge.plus") ) { _ in
self.alertNewFolder()
},
UIAction(title: "new image or video", image: UIImage(systemName: "camera.fill") ) { _ in
self.getMedia()
},
UIAction(title: "text", image: UIImage(systemName: "note.text.badge.plus") ) { _ in
//Here I move to ViewController B
let vc = self.storyboard?.instantiateViewController(withIdentifier: "VCText") as! VCText
vc.delgateText = self
self.navigationController?.pushViewController(vc, animated: true)
},
])
return AddMenuItem
}
This is ViewController B
class VCText: UIViewController {
@IBOutlet weak var doneBtn: UIButton!
@IBOutlet weak var nameNote: UITextField!
@IBOutlet weak var detilesNote: UITextView!
var delgateText : addTextMenu?
var arrS1 : [addCatogrey] = []
var name : String?
var detl : String?
override func viewDidLoad() {
super.viewDidLoad()
nameNote.text = name
detilesNote.text = detl
}
@IBAction func doneBtnClicke(_ sender: Any) {
guard let name = nameNote.text , !name.isEmpty else {
return
}
guard let detiles = detilesNote.text else {
return
}
arrS1.append(addCatogrey(nameCatog: name, imageSection: UIImage(systemName: "note.text"), detilesNote: detiles, nameData: "note"))
delgateText?.DelegateText(arrData: addCatogrey(nameCatog: name, imageSection: UIImage(systemName: "note.text"), detilesNote: detiles, nameData: "note"))
doneBtn.isEnabled = false
doneBtn.setTitle("", for: .normal)
}
}
protocol addTextMenu {
func DelegateText (arrData : addCatogrey)
}
I am making the edit from the ViewController B
I want to press the back button and find the value has been modified