故事板 performSegueWithIdentifier 不工作
Storyboard performSegueWithIdentifier not working
我目前正在尝试将图像预览视图控制器更改为 Select 品牌视图。我首先尝试使用 segue。 Storyboard Segue 设置正确,没有拼写错误,但不起作用。
在我的图像预览视图控制器代码中,我有
-(void)brandButtTapped:(UIButton*)button{
NSLog(@"brandbuttTapped");
[self performSegueWithIdentifier:@"imagePreviewVCtoBrandSearchVC" sender:self];
}
但是我收到一条错误消息
'Receiver () 没有带标识符 'imagePreviewVCtoBrandSearchVC' 的 segue''
我的代码有什么问题?谢谢,如果您想查看更多代码,请随时询问!
编辑
我注意到您的 brandButton
有一个错误的方向。连接你从你的 brandButton segue 并拖动到你的 VC,而不是从你的 VC 到你的 brandButton。
重新编辑
您似乎没有任何东西可以提供正确调用代码的响应;一个按钮。如果你这样做了,你就不必编写任何代码来要求转换回来,因为 segue 会自动执行。
尝试通过 selecting TableView 将 TableViewController 嵌入 UINavigationController --> Select 从屏幕编辑器顶部的菜单 --> Select 嵌入 -- > Select 导航控制器。
这样你就赢了;不必担心编码转换回来,你可以选择 return 内置。
否则,继续下面的代码。
然后
要么尝试:
//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];
或尝试呈现视图控制器。将您希望更改的视图命名为 - Select 您的第二个视图。然后 select StoryBoard 编辑器并命名你的 selected VC:
然后像这样编写您的按钮以更改视图:
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
我目前正在尝试将图像预览视图控制器更改为 Select 品牌视图。我首先尝试使用 segue。 Storyboard Segue 设置正确,没有拼写错误,但不起作用。
在我的图像预览视图控制器代码中,我有
-(void)brandButtTapped:(UIButton*)button{
NSLog(@"brandbuttTapped");
[self performSegueWithIdentifier:@"imagePreviewVCtoBrandSearchVC" sender:self];
}
但是我收到一条错误消息
'Receiver () 没有带标识符 'imagePreviewVCtoBrandSearchVC' 的 segue''
我的代码有什么问题?谢谢,如果您想查看更多代码,请随时询问!
编辑
我注意到您的 brandButton
有一个错误的方向。连接你从你的 brandButton segue 并拖动到你的 VC,而不是从你的 VC 到你的 brandButton。
重新编辑
您似乎没有任何东西可以提供正确调用代码的响应;一个按钮。如果你这样做了,你就不必编写任何代码来要求转换回来,因为 segue 会自动执行。
尝试通过 selecting TableView 将 TableViewController 嵌入 UINavigationController --> Select 从屏幕编辑器顶部的菜单 --> Select 嵌入 -- > Select 导航控制器。
这样你就赢了;不必担心编码转换回来,你可以选择 return 内置。
否则,继续下面的代码。
然后
要么尝试:
//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];
或尝试呈现视图控制器。将您希望更改的视图命名为 - Select 您的第二个视图。然后 select StoryBoard 编辑器并命名你的 selected VC:
然后像这样编写您的按钮以更改视图:
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