UIBarButtonItem* saveButton = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemDone
target:hvc //other controller
action:@selector(save:)];
UIBarButtonItem* cancelButton = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemCancel
target:self
action:@selector(cancel:)];
self.navigationItem.rightBarButtonItem = saveButton;
self.navigationItem.leftBarButtonItem = cancelButton;
I have two buttons being made in a view controller. I'm trying to design the save button to take in the data in some textfields and send it to another view controller, while cancel button just dismisses the current view controller.
Other view controller was initialized in the app delegate file.
How do I define the target
for the save button to be this other view controller ?