In order not to make duplicate, I didn't ask until now and I was trying all day long. So I know it has been asked before, but none of them helped me. I'm having trouble with using storyboard and it is getting more and more confusing.
I found out on the internet that using segues and overriding the method performSegueWithIdentifier:sender
: would have me and I tried to that. I implemented that as:
- (IBAction)segmentChanged{
if([segmentedControl selectedSegmentIndex] == 0)
[self performSegueWithIdentifier:@"Doviz" sender:self];
else
[self performSegueWithIdentifier:@"Altin" sender:self];
}
Here is my storyboard:
Please note that I'm connecting with push method rather than embed, modal and custom, and connecting them not to the segmentedController but to the view. Maybe there might be also something wrong. Lastly, when I'm trying to running my application, I took the error:
Could not find a navigation controller for segue 'Altin'. Push segues can only be used when the source controller is managed by an instance of UINavigationController.
I'm new and learning Xcode 'til 1 week, so I'll be much appreciated if you can give me an detailed answer on this.
Setup your storyboard so it looks like this:
An ensure to give each segue the appropriate identifier in the Attributes Inspector (Command+Option+4).
Please bare in mind that using a segmented control for pushing on view controllers isn't a standard UI paradigm. It may be more appropriate to use regular
UIButton
controls.