using a button to navigate to different view in navigation based application?
i created a navigation based project but instead of tableview i added a new view with a button to navigate to the other view.. my button code is as shown below but whenever i run it the application doesn't run?? is the code wrong or navigation based application only work with tableview??
-(IBAction)clickMe:(id)sender
chdDetails *details=[[chdDetails dalloc]initWithNibName:@"chdDetails" bundle:nil];
[self.n开发者_JS百科avigationController pushViewController:details animated:YES];
[details release];
details=nil;
It says "[[chdDetails dalloc]initW.... instead of alloc. is that a copy-waste typo?
No a navigationCOntroller will work with any viewController, you don't even need the navigationbar. I bet most application are navigationBased but you don't even see it.
[self.navigationController.navigationBar setHidden:YES]
Will do that.
Try placing a breakpoint in the clickMe
method to test if it even gets called. What does this mean: "the application doesn't run??" is there an error message? Have you hooked the button up in IB? Is chdDetails a subclass of UIViewController? etc. etc.
Is chdDetails an UIViewController or an UIView? You can't push an UIView on an UINavigationController, only controllers.
精彩评论