I am currently new to programming, previously programmed with matlab only, and was wondering why the code below isn't working. Initially, I connected two ViewControllers by using the "popover" option when control clicking and dragging the text field to the secondviewcontrol. However, I realised that I was then unable to connect the text field to the same ViewController page. After some research, I was told that I had to write the program for popovers in order to include functions in the popover.
My question is that if I continue to use the storyboard way to switch between two ViewControllers, how can I write functions for the buttons/textfields in the secondViewController.
However, if this is not possible then below is my second question regarding my program.
The program below seemed to work for other people but not for me. And I am wondering why it wouldn't work. When I run the program, there aren't any errors therefore the program doesn't crash, however the button is unable to carry out the function switch. The textfield, which I controlled click to connect to the ViewController on the right, is called TodaysEntry.
@IBAction func Todaysentry(sender: UIButton) {
func switchScreen() {
let mainStoryboard = UIStoryboard(name: "Main", bundle: NSBundle.mainBundle())
let vc : UIViewController = mainStoryboard.instantiateViewControllerWithIdentifier("TodaysReview") as UIViewController
self.presentViewController(vc, animated: true, completion: nil)}
I am sorry if this is unclear or confusing. Please tell me if there's any clarification needed.