PerformSegueWithIdentifier storyboard not working
I am currently trying to go to Image View View Controller to select the brand view. At first I tried using segue. Storyboard Segue installs correctly with no spell errors but doesn't work.
In my View Code View Picture Profile I have
-(void)brandButtTapped:(UIButton*)button{
NSLog(@"brandbuttTapped");
[self performSegueWithIdentifier:@"imagePreviewVCtoBrandSearchVC" sender:self];
}
However, I am getting the error
'Receiver () does not have a segue with id' imagePreviewVCtoBrandSearchVC '' '
What's wrong with my code? Thanks, if you would like to know more about the code, please don't hesitate to ask!
source to share
EDIT
I noticed that you have a wrong path from yours brandButton
. Connect you to your BrandButton and drag it to your VC, not from your VC to your BrandButton.
RE-EDIT
You don't seem to have anything to provide an answer to call the code correctly; Button. If you did, you would not need to code anything to require the jump back, because the segue will be automatically executed.
Try to embed your TableViewController in a UINavigationController by choosing TableView -> Select from the menu at the top of the screen. Editor -> Select Built-in -> Select NavigationController.
This way you win, you don't have to worry about rewriting the code back, you can revert to the inline version.
Otherwise go to the below code.
THEN
Try:
//note YOU HAVE NOT INCLUDED .storyboard
// Get the storyboard from the main bundle - check the name to confirm:
NSString * storyboardName = @"Main";
UIStoryboard *storyboard = [UIStoryboard storyboardWithName:storyboardName bundle: nil];
[storyboard performSegueWithIdentifier:@"imagePreviewVCtoBrandSearchVC" sender:self];
OR Try to present a view controller. Name your view you want to change - select the second view. Then select the StoryBoard editor and name the selected VC:
Then enter the code to change the view:
NSString * storyboardName = @"Main";
UIStoryboard *storyboard = [UIStoryboard storyboardWithName:storyboardName bundle: nil];
UIViewController * vc = [storyboard instantiateViewControllerWithIdentifier:@"secondViewController"];
[self presentViewController:vc animated:YES completion:nil];
//animated can be NO
source to share