Clicking the UIViewController on the NavigationController doesn't actually click the view

I have this code in a table view controller (and delegate):

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { DetailStatus *detailViewController = [[DetailStatus alloc] initWithNibName:@"DetailStatus" bundle:nil status:[mStatuses objectAtIndex:indexPath.row]]; [[self navigationController] pushViewController:detailViewController animated:YES]; [detailViewController release]; [self.tableView deselectRowAtIndexPath:indexPath animated:NO]; NSLog(@"exiting didselectrow"); } 

And in my DetailStatus class:

 - (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil status:(NSDictionary *)pStatus { NSLog(@"I am being called %d", [pStatus objectForKey:@"id"]); self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil]; if (self) { // some stuff } return self; } 

The funny thing is that my DetailStatus is actually initialized, it even displays "I am being called 000001" in the console window, but it is strange that the view does not appear in the table view ...

I checked the nib name and everything is fine. I checked the DetailStatus header file, it looks fine (for example):

 @interface DetailStatus : UIViewController { 

So does anyone know why the view will not be clicked on the window, even if I initialized and clicked it?

UPDATE: I tried to write some debugging messages to viewDidLoad in DetailStatus, and it seems that the view does not load even if the class was created ... I wonder why.

UPDATE2: I have a feeling that it could be my navigation manager organization, which is wrong. I have the following:

 Login page -> customtabbar -> First table view -> DetailStatus -> Second table view -> DetailStatus 

I think that I support only one navigation controller in this hierarchy. I have never created other navigation controllers. I just click scan after another.

Thanks everyone for the answers! I will hand out the award soon, I will let other people vote first before the deadline.

+4
source share
7 answers

Looking at it, the script seems like me. What I first saw in Tab + Navigation.

I am sure there are some problems with your Tab + Navigation application. Although it shows a tab, as well as navigation can not move through the main stream. And it’s very difficult to solve your problem with such less code.

Instead, I had an alternative solution for the same:

Once you have the tab bar in XIB, the easiest way to approach this is to drag the UINavigationController object from the library window (looks like the left navigation button on a gold background) into the Tree View for your bar tab (text view only, not GUI). Place it under the tab bar, and then drag the existing view controller under the tab bar controller, not under the tab bar.

When you go to this tab, you should see the navigation bar at the top ... if you load the navigation controller from another xib, you will change the navigation bar in the xib tab bar.

otherwise you can below, you can follow the best url for the same:

http://books.google.co.in/books?id=2yYlm_2ktFYC&pg=PA179&lpg=PA179&dq=navigation+with+the+tab+based+application+iphoneSDK&source=bl&ots=nf2YYjX5Am&sig=COpHj9wOtsDChQBglpsljSTsElw&hl=en&ei=3ZoFTeGSOI_tsgbc_Iz6CQ&sa=X&oi=book_result&ct= result & resnum = 6 & ved = 0CDAQ6AEwBQ # v = onepage & q & f = false

http://www.youtube.com/watch?v=LBnPfAtswgw

Hope this solves your problem.

+6
source

If the UINavigationController is the direct parent of your table view controller, [self navigationController] will return nil .

I don’t know exactly where it is in the hierarchy of the view manager, based on your explanations, but I suspect you might have your UITabBarController nested in the navigation controller when it should be the other way around. If by accident you intend to pull the tab bar off the screen (and therefore you want the tab bar controller to be nested in the navigation controller), you need to call something like the following:

 UIViewController *parentViewController = self.parentViewController; [parentViewController.navigationController pushViewController:detailViewController animated:YES ]; 

PS After the click works correctly, you do not need to cancel the selected row, since the UITableViewController does this automatically when the view reappears.

+2
source

I have not seen putting status at the end of the view initialization. Assuming you added.

No need to just do [self pushViewController etc. instead of the navigationController bit

0
source

It cannot be that the thread is not properly connected. That is, in nib there is no connection between the view and the controller, therefore, although the controller is configured correctly, the navigation controller cannot find the view.

Just guess!

0
source

alt text

You need to implement as above. In the tab controller, place the navigation controller according to your tabs and in the navigation controller, you can place your tab element. And also you need to set the peer element of the tab bar item. Then, by touching the tab, you get the tab screen and because of the navigation controller you can easily navigate. Even if you can move around the screen of any main tab screen. This is what you need to implement.

This definitely helps you, but you need a logical implementation.

0
source

Is your TableViewController directly clicked on the navigation controller or is there another viewController in between? Check the [self navigationController] value for the value of your navigation controller (from where you actually initiate it)

0
source

After verifying that you have initialized the First Tableview and Second TableView with the navigation controller or not.

When adding to the tabBar, you added the UINavigationController or just the UIViewController object.

 PM_FirstNavigationController *First_navController = [[PM_FirstNavigationController alloc] initWithRootViewController:FirstTableViewController]; tabBarController.viewControllers= [NSArray arrayWithObject: First_navController]; 

You need to add view controllers in a tabBar like this.

Then, when calling [self navigationController], it will give the navigation controller object.

Hello,

Satya

0
source

All Articles