若是想在UIView中直接进行跳转操做,你能够这么写

#import "QHChatRedBagView.h"
#import "QHRedPacketGetingViewController.h"

@interface QHChatRedBagView ()

@end

@implementation QHChatRedBagView


#pragma mark 点击红包领取
- (IBAction)clickRedBag:(id)sender {
    QHRedPacketGetingViewController  *redViewCtrl = [[QHRedPacketGetingViewController alloc]initWithNibName:@"QHRedPacketGetingViewController" bundle:nil];
    UIViewController *vc = [self obtainVisible];
    [vc.navigationController pushViewController:redViewCtrl animated:YES];
}


- (UIViewController *)obtainVisible {
    UITabBarController *tabCtrl = (UITabBarController *)[UIApplication sharedApplication].keyWindow.rootViewController;
    UINavigationController *navi = tabCtrl.selectedViewController;
    UIViewController *vc = [navi visibleViewController];
    return vc;
    
}

@end
相关文章
相关标签/搜索