iOS编程, 推页面时, 找到根VC

在cell 里推页面的时候.

// 获取该视图层最下边的VC.
id object = [self nextResponder];
    while (![object isKindOfClass:[UIViewController class]] &&
           object != nil) {
        object = [object nextResponder];
    }

    UIViewController *vc = (UIViewController*)object;
// VideoPlayerVC 是被推出的VC.
    VideoPlayerVC *player = [[VideoPlayerVC alloc] init];
    [vc.navigationController pushViewController:player animated:YES];

你可能感兴趣的:(iOS编程, 推页面时, 找到根VC)