iOS First Launch视图 [英] iOS First Launch view

查看:130
本文介绍了iOS First Launch视图的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试放置第一个启动视图。我已经尝试了一些东西,但这不会起作用。

I am trying to put a first launch view. I already tried some stuff but that won't work.

这是我所拥有的:

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{

    UIPageControl *pageControl = [UIPageControl appearance];
    pageControl.pageIndicatorTintColor = [UIColor lightGrayColor];
    pageControl.currentPageIndicatorTintColor = [UIColor blackColor];
    pageControl.backgroundColor = [UIColor whiteColor];

    return YES;

    if ([[NSUserDefaults standardUserDefaults] boolForKey:@"yourCondition"])
    {
        //launch your first time view
        self.viewController = [[viewController alloc] initWithNibName:@"viewController" bundle:nil];
    }
    else
    {
        //launch your default view
        self.viewController = [[viewController alloc] initWithNibName:@"defaultViewController" bundle:nil];

        [[NSUserDefaults standardUserDefaults] setBool:NO forKey:@"yourCondition"];
        [[NSUserDefaults standardUserDefaults] synchronize];
    }

}

某种方式不起作用说找不到viewController作为AppDelegate的对象类型。任何想法?

Somehow that doesn't work it says that viewController is not found as an object type of AppDelegate. Any Ideas?

推荐答案

如果你什么都不做,故事板的初始视图控制器就会出现。如果你想要其他东西发生,你想要设置的是 self.window.rootViewController 。在这种情况下,您还需要手动创建和显示窗口。

If you do nothing, the storyboard's initial view controller will appear. If you want something else to happen, what you want to set is self.window.rootViewController. In that case you will also need to create and show the window manually.

这篇关于iOS First Launch视图的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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