0

我正在使用自定义控件SWRevealController用于像 facebook 这样的左滑菜单。如果用户未登录,我必须要求用户登录并选择需要登录的选项。

我在单击和用户登录时显示身份验证视图控制器。成功后,我应该根据登录前选择的行推送视图控制器。

我在用:

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

但它不会将视图控制器推送到该行。

我已经实现了委托方法来获取用户是否成功登录的响应,并且我收到了成功。

这是我的tableView委托方法:

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

这是我在登录成功时使用的委托方法:

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

}

我也试过这个:

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

}

如果我使用错误的方法,我怎么能做到这一点。

4

0 回答 0