gpt4 book ai didi

ios - 禁用 Storyboard 跳转

转载 作者:行者123 更新时间:2023-11-29 02:10:34 31 4
gpt4 key购买 nike

我已经创建了一个关于 Storyboard的项目, Storyboard上有两个名为“loginViewController”、“BViewController”的 View Controller ,loginViewController 上有一个登录按钮,我已经将登录按钮触发的 segues 操作设置为 BViewController。

在登录按钮的情况下,如果登录成功我想跳转到 BViewController 否则禁用跳转,但看起来总是跳转到 BViewController,我怎么让它不跳转?

if (loginResult)
{
[self.navigationController popViewControllerAnimated:YES];
}
else
{

}

最佳答案

您应该在 UIViewController 之间设置 segue,并在按钮上设置单独的 IBAction。在 IBAction 中使用:

 if (loginResult)
{
[self performSegueWithIdentifier:@"jumpToBViewController" sender:self];
}

不要忘记在 Storyboard上将segue的标识符设置为“jumpToBViewController”。

关于ios - 禁用 Storyboard 跳转,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29329793/

31 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com