在从 ViewController 到 TableViewController 的 segue 中的 viewDidLoad 之后调用prepareForSegue

发布于 2024-12-28 03:37:30 字数 956 浏览 1 评论 0原文

我正在构建一个集成了 oauth 的 iOS 5 应用程序。我的故事板由一个容器 NavigationController、一个 rootViewController 和两个从 rootView 延续的 viewController 组成。当应用程序启动时,我会检查是否存在访问令牌,并相应地指导用户。

// rootViewController.m viewDidAppear (i need to perform this check anytime the user is brought to the root view, say for e.g. he logs-out.)

if (accessToken) {
    BOOL didAuth = [GTMOAuthViewControllerTouch authorizeFromKeychainForName:@"app name: service" authentication:accessToken

    if (didAuth){

        //perform segue to main User View (which is a TableViewController)
    }

    else{

        //perform segue to sign-in controller, and direct the user to main view from there.
    }

}

我有几个问题:

  1. 根据 Apple 的界面指南,此类设置“有效”吗?

  2. 我注意到rootViewController 中的prepareForSegue 方法在mainUserView(这是一个TableViewController)的viewDidLoad 之后被调用。这是标准行为吗?我知道弹出窗口就是这种情况,但是对于从标准 ViewController 到 TableViewController 的情况?

谢谢!

I am building an iOS 5 app with oauth integrated. My storyboard consists of a container NavigationController, with a rootViewController, and two viewControllers segueing from the rootView. When the app is launched, i perform a check to see if an access token is present, and direct the user accordingly.

// rootViewController.m viewDidAppear (i need to perform this check anytime the user is brought to the root view, say for e.g. he logs-out.)

if (accessToken) {
    BOOL didAuth = [GTMOAuthViewControllerTouch authorizeFromKeychainForName:@"app name: service" authentication:accessToken

    if (didAuth){

        //perform segue to main User View (which is a TableViewController)
    }

    else{

        //perform segue to sign-in controller, and direct the user to main view from there.
    }

}

I have a couple of questions:

  1. Is such a setup 'valid' as per Apple's Interface Guidelines?

  2. I noticed that the prepareForSegue method in rootViewController gets called after the mainUserView's (which is a TableViewController) viewDidLoad. Is this standard behavior? I understand that this is the case for popovers, but for segues from a standard ViewController to a TableViewController?

Thanks!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文