Pergunta

I was able to implement the below mentioned library in my project. Library used:: https://github.com/rolandleth/LTHPasscodeViewController

After entering the pin-code and after verifying that it is correct, i am not able to switch to tab-bar activity after the pin-code entry directly but if i use an NSNotification in between i am able to transfer control.

My code:

 - (void) receiveTestNotification:(NSNotification *) notification
{
    if ([[notification name] isEqualToString:@"TestNotification"])
        NSLog (@"Successfully received the test notification!");   
    UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"Main" bundle:nil];
    mainTabViewController *objSec=[storyboard instantiateViewControllerWithIdentifier:@"passID"];
    [self.navigationController pushViewController:objSec animated:YES];

After putting an NSLog also i am getting the Log output but the tab-view doesn't come.

Is there a way to call the tab-view directly after pin-entry.

[[NSNotificationCenter defaultCenter] addObserver:self
                                             selector:@selector(receiveTestNotification:)
                                                 name:@"TestNotification"
                                               object:nil];

Tabview done using StoryBoard.

Foi útil?

Solução

I think it happens because callback method from this library are performed in background thread, try to wrap you code with dispatching on main thread, it should help:

dispatch_async(dispatch_get_main_queue(), ^{
    UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"Main" bundle:nil];
    mainTabViewController *objSec=[storyboard instantiateViewControllerWithIdentifier:@"passID"];
    [self.navigationController pushViewController:objSec animated:YES];
}];
Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top