【问题标题】:Problems with splash screen, segue and timers闪屏、segue 和计时器的问题
【发布时间】:2013-12-19 20:38:35
【问题描述】:

我正在尝试使用计时器和 segue 制作启动画面,这将在 2 秒后执行。这是我的 SplashScreenClass.m 中的一段代码。怎么了?

- (void)viewDidLoad
{
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    [NSTimer scheduledTimerWithTimeInterval:2.0
                                     target:self
                                   selector:@selector(performSegue)
                                   userInfo:nil
                                    repeats:NO];
}
-(void)performSegue{
    [self performSegueWithIdentifier:@"splash" sender:self];

【问题讨论】:

    标签: objective-c nstimer segue splash-screen


    【解决方案1】:

    在 Apple 的人机界面指南中,建议不要使用启动画面。您的应用可能会因此被拒绝。

    【讨论】:

    • 谢谢,但是如何实现呢?尽管有人机界面指南?只是理论上?
    • 我在几个应用程序中使用了启动画面,每个应用程序都通过了 Apple 审查。重要的是它们不会持续太久。
    【解决方案2】:

    使用计时器来解决这个问题并不是最好的解决方案。我建议改为在延迟后执行选择器。它更容易使用。只需将此行放在您的 viewDidLoad 方法中即可。

    [self performSelector:@selector(performSegue) withObject:nil afterDelay:2];
    

    【讨论】:

    • 它不起作用。 Xcode 显示同样的问题 "Thread 1:signal SIGABR"
    • 这一行应该没有问题。也许你的故事板和序列有一些问题。
    • 会是什么问题?
    猜你喜欢
    • 1970-01-01
    • 2011-11-26
    • 1970-01-01
    • 2016-01-18
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多