【问题标题】:change view after viewDidAppear (Storyboard)在 viewDidAppear 之后更改视图(故事板)
【发布时间】:2013-09-02 10:03:17
【问题描述】:

如何在 viewDidAppear:(BOOL)animated 函数中从视图更改视图(使用代码)(将视图切换到我在代码中命名的视图)? 我使用故事板。

编辑:

View_Info *Info =[[View_Info alloc]initWithNibName:nil bundle:nil];
[self presentModalViewController:Info animated:NO];

没有错误,只有警告:

"PredentModalViewController 动画已弃用:iOS6 中首次弃用

感谢您的帮助

【问题讨论】:

  • 你有没有为此尝试过?如果是,那么编写一些代码和你得到的错误
  • 使用这个 [self presentViewController:Info animated:NO completion:nil];
  • 谢谢。但现在还有一个问题我试过的这段代码是用 xib 文件而不是故事板。如何将它与 Storyboard 一起使用?

标签: iphone view storyboard


【解决方案1】:

您可以尝试此操作并根据您的要求修改此代码,如果有效,请不要忘记接受此答案并投票 :) 谢谢。

AppDelegate* appDelegate = (AppDelegate*)[[UIApplication sharedApplication] delegate];
MainViewController *mvc = (MainViewController *)appDelegate.window.rootViewController;    
LoginViewController *lvc = [mvc.storyboard instantiateViewControllerWithIdentifier:@"LoginViewController"];
[currentVC presentModalViewController:lvc animated:YES];

【讨论】:

  • 好的,谢谢你能再次在这里帮忙:MainView 被命名为“Launch”,Login 被命名为“Start”
  • 在你的故事板中会有一个用于你的 Start viewController 的 xib 并给它一个标识符“Start”,然后使用上面的代码并编写这个 [mvc.storyboard instantiateViewControllerWithIdentifier:@"Start"];
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2014-09-12
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多