iphone初心者です。uinavigation コントローラーについて少し混乱しています。そのビュー コントローラーの最初のビュー コントローラーにナビゲーション バーが必要です。クリックするとナビゲーション バーにボタンがあり、そこから別のビュー コントローラー (2 番目のビュー コントローラー) がプッシュされます。クリックすると戻るボタンです。そのView Controllerをポップして、最初のView Controllerに戻りたいと思います。誰かがこれを知っている場合は、私を助けてください。コードで説明すると、私たちをよりよく理解できます。
私がこれまでに書いた次のコードは、ここでは現在のモーダルビューコントローラーとモデルビューコントローラーの却下は機能していますが、プッシュビューコントローラーとポップビューコントローラーは機能していません
appDelegate で私はこのように書いています
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
//create a window
self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
//biblePlayerController is an instance of BiblePlayerViewController class and then set the biblePlayerController as a rootViewController to the window
self.biblePlayerController = [[BiblePlayerViewController alloc] initWithNibName:@"BiblePlayerViewController" bundle:nil];
navigationController = [[UINavigationController alloc]initWithRootViewController:self.biblePlayerController];
// self.window.rootViewController = self.biblePlayerController;
[self.window addSubview:navigationController.view];
//make the window visible
[self.window makeKeyAndVisible];
return YES;
}
//In initial View controller there is a navigation on that there is a download button code for that is
//BiblePlayerViewController.m
UIBarButtonItem *downloadButton = [[UIBarButtonItem alloc] initWithTitle:@"Download" style:UIBarButtonItemStylePlain target:self action:@selector(gotoProgressViewController:)];
self.navigationItem.rightBarButtonItem = downloadButton;
- (IBAction)gotoProgressViewController:(id)sender {
@try {
//ShowProgressViewCont is initialized with the nibName
showProgressViewController = [[ShowProgressViewCont alloc]initWithNibName:@"ShowProgressViewCont" bundle:nil];
//UINavigationController is initialized with the rootViewController showProgressViewController
navigationController = [[UINavigationController alloc]initWithRootViewController:showProgressViewController];
//The transition style of the navigationController is set to UIModalTransitionStyleCrossDissolve
navigationController.modalTransitionStyle = UIModalTransitionStyleCrossDissolve;
//Presents a modal view managed by the given view controller to the user.Here navigation Controller that manages the modal view.
[self presentModalViewController:navigationController animated:YES];
// [navigationController pushViewController:showProgressViewController animated:YES];
}
@catch(NSException * e){NSLog(@"Exception At10: %s %d %s %s %@",__FILE__,__LINE__,__PRETTY_FUNCTION__,__FUNCTION__,e);}@finally{}
}
上記のコードで presentModalViewController は機能していますが、pushViewController は機能していません。体がこれを知っているなら、私を助けてください..