获取iPhone应用程序显示两个不同的视图之一 [英] Getting iPhone app to display one of two different views

查看:152
本文介绍了获取iPhone应用程序显示两个不同的视图之一的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个程序,我们正在使用导航控制器,并需要应用程序启动到两个不同的视图之一。基本上如果先前输入了某些信息,那么我们需要该应用启动查看A,但是如果信息从未被输入,那么我们需要启动该视图才能查看B.我很难让这个工作正常工作,并且想知道什么方法如果有的话我可以实现这一点。我确定它需要在应用程序委托中完成,但我不知道如何。感谢提前!

解决方案

在您的应用程序委托中实施以下方法。



(BOOL)应用程序:(UIApplication *)应用程序didFinishLaunchingWithOptions :( NSDictionary *)launchOptions
{
[window makeKeyAndVisible];
if(condition){
[window addSubview:[mainViewControllerA view]];
} else {
[window addSubview:[mainViewControllerB view]];
}
}

您可以根据您的需要选择要加载的视图条件。


I have a program where we are using a navigation controller and need the app to launch to one of two different views. Basically if certain info has previously been entered then we need the app to launch to view A, but if the info has never been entered then we need it to launch to view B. I am having difficulty getting this to work and am wondering what ways if any I could implement this. I am certain it needs to be done in the app delegate but I am not sure how. Thanks in advance!

解决方案

Implement the following method in your app delegate.

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{    
    [window makeKeyAndVisible];
    if(condition) {
        [window addSubview:[mainViewControllerA view]];
    } else {
        [window addSubview:[mainViewControllerB view]];
    }
}

There you can choose which view to load depending on your condition.

这篇关于获取iPhone应用程序显示两个不同的视图之一的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆