performSegueWithIdentifier method is very slow for modal segue

496 views Asked by At

I have to show registration view controller. Currently this screen is loaded with UIWindow.rootViewController method,which I don't like as a solution.

After Google search I found this question, which doesn't help me at all (problem stays), so I have to ask, are there any other solutions.My code is as follows:

-(void)viewDidAppear:(BOOL)animated
{
  [super viewDidAppear:animated];
  if(![Class isUserRegistered]){
    [self performSegueWithIdentifier:@"" sender:self];
  }
}

Registration controller shows after 5-7 seconds (iPhone 4, 7.1.2)

One possible option is to use adaptive segue-s, but this is not possible at the moment.

I notice, that when I remove all outlets from storyboar, view is loading much faster.

Any thoughts?

1

There are 1 answers

1
Saif On

Try this,

dispatch_async(dispatch_get_main_queue(), ^{
    //this block of code is executed on main thread, all UI operations should be done on main thread
    [self performSegueWithIdentifier:@"" sender:self];
});