I’m new to programming in objective C so I have a feeling this is just something really stupid I’m doing or failing to do…
I have an iPhone app and am trying to navigate from one view to another. I hooked up a segue and when I call it, like this:
[self performSegueWithIdentifier:@"ShowPolicyInformation" sender:sender];
it works just fine. But now I want to pass a value to my new view, and from what I can tell I can’t do that with a segue. So I setup some properties on it and am trying to navigate to it more manually:
PolicyInfoViewController *pol =[[PolicyInfoViewController alloc] initWithNibName:@"PolicyViewController" bundle:nil];
pol.PropertyOne=txtOne.text;
pol.strPropertyTwo=txtTwo.text;
[[self navigationController] pushViewController:pol animated:YES];
When I replace the performSeque code with the code above, it builds fine, but I get this error when I run it:
Terminating app due to uncaught exception ‘NSInternalInconsistencyException’, reason: ‘Could not load NIB in bundle: ‘NSBundle (loaded)’ with name ‘MainMobileViewController”
When I search for help with this issue, all of the suggests that are shown talk about making sure the .xib file is named correctly….and here is where I’m completely lost, because I don’t have any .xib files that I can see. I’m working with a storyboard and just drag/dropping the views onto it and connecting it to classes I create. So…what newbie mistake am I making? What am I missing? I am working with xCode 4.4, so is this just different code than what I’m finding in these searches? Any help or advice would be greatly appreciated.
You can perform this by using Story Board only and not having to have a separate nib file for the PolicyInfoViewController… It would probably easier for you to do it this way.
so in keeping the first line of code:
You would need to override this method to manipulate properties of the PolicyInfoViewController
So what is happening here? First bit of code you are telling the control to perform the particular segue from story board. Second bit you are telling control what to do when a particular segue is called.