因为时间问题,直接上重要代码
在#import "AppDelegate.m"文件中>>
static AppDelegate *__delegate = nil;
@implementation AppDelegate
AppDelegate *myDelegate(void){
return __delegate;
}
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
MainTabbarVC *main = [[MainTabbarVC alloc] init];
self.window.rootViewController = main;
__delegate = self;
_masterTabbarController = main;
[self.window makeKeyAndVisible];
return YES;
}
在接收到消息通知的方法里面:
// 跳转页面 跳转到消息列表页面
ViewController *viewC = [[ViewController alloc] init];
[AppDelegate mastePushViewController:viewC];
// push方法
+ (void)mastePushViewController:(UIViewController *)controller
{
UINavigationController *nvc = myDelegate().masterTabbarController.selectedViewController;
[nvc pushViewController:controller animated:YES];
}
//此时就完成跳转界面的操作
网友评论