Frank
Frank

Reputation: 507

Problems with splash screen, segue and timers

I am trying to make a splash screen with timer and segue, that wil be performed after 2 seconds.It is a piece of code frome my SplashScreenClass.m. What is wrong?

- (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];

Upvotes: 0

Views: 193

Answers (2)

codeplasma
codeplasma

Reputation: 515

It's not the best solution to use timer for solving this problem. I recommend performing selector after delay instead. It's quite easier to use. Just put this line in your viewDidLoad method.

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

Upvotes: 1

Choppin Broccoli
Choppin Broccoli

Reputation: 3076

In Apple's Human Interface Guidelines, it is recommended that splash screens not be used. Your app could get rejected for this reason.

Upvotes: 1

Related Questions