若是想在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
相關文章
相關標籤/搜索