在iOS目标C登录后显示屏幕

我的故事板上有2个viewControllers,正在进行登录(全部使用目标C),当凭据确定时,我需要显示另一个屏幕(并在可能的情况下发送数据),但是我发现了带有segues的示例并使用按钮来执行此操作,我不想将按钮设置为segue,因为当我按下按钮时,将显示另一个屏幕

我只需要在“如果凭据还可以的情况下”显示新屏幕

caobin914819 回答:在iOS目标C登录后显示屏幕

您可以创建一个序列号,为其提供一些ID,然后在需要时像这样调用:

[self performSegueWithIdentifier:@"loginSeque" sender:self];
,

您可以手动创建登录按钮操作,然后尝试以下代码。

- (IBAction)LoginButtonAction:(id)sender {

    if ([self validated]) {    // check login validation on "validate" method. 

         UIStoryboard *story = [UIStoryboard storyboardWithName:@"Main" bundle:nil];
         HomeVC *home = [story instantiateViewControllerWithIdentifier:@"HomeVC"];

         UINavigationController *NavigationController = [[UINavigationController alloc] initWithRootViewController: home];    // for set HomeVC as a root view controller.

         [[UIApplication sharedApplication].keyWindow setRootViewController:NavigationController];
    }
}
本文链接:https://www.f2er.com/3157577.html

大家都在问