我在我的应用程序中嵌入了苹果推送通知。弹出通知时,我会看到一个警报 View ,当单击 View 时,我会导航到详细信息 Controller 。但是,在单击查看按钮后,它什么也没做,它卡住了应用程序。这是我在警报 View 中打开详细信息的代码点击:
self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
DetailsViewController *list = [[DetailsViewController alloc]initWithNibName:@"Details" bundle:nil];
RearTableViewController *rearView = [[RearTableViewController alloc] init];
UINavigationController *frontNavigationController = [[UINavigationController alloc] initWithRootViewController:list];
UINavigationController *rearNavigationController = [[UINavigationController alloc] initWithRootViewController:rearView];
SWRevealViewController *mainRevealController = [[SWRevealViewController alloc]
initWithRearViewController:rearNavigationController frontViewController:frontNavigationController];
mainRevealController.delegate = self;
[self.window.rootViewController presentViewController:mainRevealController animated:YES completion:nil];
[self.window makeKeyAndVisible];
提前致谢!
最佳答案
//Don't realloc self.window.
//self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
DetailsViewController *list = [[DetailsViewController alloc]initWithNibName:@"Details" bundle:nil];
//Alloc this VC with nib name like initWithNibNamed:bundle:
RearTableViewController *rearView = [[RearTableViewController alloc]initWithNibName:@"RearTableViewController" bundle:nil];
UINavigationController *frontNavigationController = [[UINavigationController alloc] initWithRootViewController:list];
UINavigationController *rearNavigationController = [[UINavigationController alloc] initWithRootViewController:rearView];
SWRevealViewController *mainRevealController = [[SWRevealViewController alloc]
initWithRearViewController:rearNavigationController frontViewController:frontNavigationController];
mainRevealController.delegate = self;
if(self.window.rootViewController){
[self.window.rootViewController presentViewController:mainRevealController animated:YES completion:nil];
}
else{
self.window.rootViewController = mainRevealController;
}
[self.window makeKeyAndVisible];
希望它能奏效。
关于ios - Apple 推送通知的应用程序委托(delegate)调用不显示 View Controller ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31238313/