跳转
- (IBAction)login:(id)sender {
secondViewController *main1 = [self.storyboardinstantiateViewControllerWithIdentifier:@"main"];
[selfpresentViewController:main1 animated:YES
completion:nil];
}
返回
- (IBAction)exit:(id)sender {
[selfdismissViewControllerAnimated:YEScompletion:nil
];
}
StartGameViewController *rootview =[[StartGameViewController alloc]init];
navigatr = [[UINavigationController alloc]init];
[navigatr pushViewController:rootview animated:YES];
[self.navigatr setNavigationBarHidden:YES animated:NO];
// self.window.rootViewController = navigatr;
[self.window addSubview:navigatr.view];
[self.window makeKeyAndVisible];
[rootview release];
//设置根控制器
//跳转
EndGameViewController * endgame1 = [[EndGameViewController alloc]init];
endgame1.score=0.0;
endgame1.worl = @"YOU LOSE.png";
[self.navigationController pushViewController:endgame1 animated:YES];
[self.navigationController popToRootViewControllerAnimated:YES];
for(UIViewController *controller in self.navigationController.viewControllers) {
if([controller isKindOfClass:[StartGameViewController class]]){
StartGameViewController * owr = (StartGameViewController *)controller;
owr.score = score;
owr.uname = uname;
[self.navigationController popToViewController:owr animated:YES];
}
}
跳转我就知道这些了,最后一个还是比较好用的。