0

I am using a custom control, SWRevealController for left-sliding menu like facebook. I have to ask user to sign in if he is not signed in and selects an option that require sign in.

I show an authentication view controller on clicking and user signs in. On success, I am supposed to push the view controller according to row selected before sign in.

I am using:

[self tableView:self.menuTable didSelectRowAtIndexPath:self.indexPath];

But it does not push the view controller on that row.

I have implemented delegate methods to get response whether user has sign in successfully or not, and I receive success.

Here is my tableView delegate method:

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{

    SWRevealViewController *revealController = [self revealViewController];
    UIViewController *frontViewController = revealController.frontViewController;
    UINavigationController *frontNavigationController =nil;

    self.indexPath = indexPath;
    if ( [frontViewController isKindOfClass:[UINavigationController class]] )
        frontNavigationController = (id)frontViewController;

    NSInteger row = indexPath.row;

        if(self.currentUser == nil){
            SignInViewController *frontViewController = [[SignInViewController alloc] init];
            frontViewController.delegate = self;
            frontViewController.title = @"Cashmails";
            UINavigationController *navigationController = [[UINavigationController alloc] initWithRootViewController:frontViewController];
            self.navController = navigationController;
            [revealController pushFrontViewController:navigationController animated:YES];

        }else{
            CashmailViewController *frontViewController = [[CashmailViewController alloc] init];
            UINavigationController *navigationController = [[UINavigationController alloc] initWithRootViewController:frontViewController];
            [revealController pushFrontViewController:navigationController animated:YES];
        }
}

Here is the delegate method I am using on getting success for sign in:

-(void) userSignInSuccessfully{
        [self tableView:self.menuTable didSelectRowAtIndexPath:self.indexPath];

}

I have also tried this:

-(void) userSignInSuccessfully{
    SWRevealViewController *revealController = [self revealViewController];
    [revealController pushFrontViewController:self.navController animated:NO];

}

How I can achieve this, if I am using wrong approach.

iBug
  • 2,334
  • 3
  • 32
  • 65

0 Answers0