views:

58

answers:

1

Basically, what I want is to be able to press a record in a table, and have it push to another view.

To do this, I created a nib file and a UIViewController subclass (for the "pushed" view). I set the nib file's "File Owner" to be the controller I created. EDIT: I also then set the "view" field of the controller to be the View. Then, in the view controller of the table that will push that view, I set the didSelectRowIndexAtPath: method to include the following:

SearchTableController *vc = [[SearchTableController alloc] initWithNibName:@"SearchTable" bundle:[NSBundle mainBundle]];
[self.navigationController pushViewController:vc animated:YES];
[vc release];

(where "SearchTableController" is the name of the UIViewController subclass and "SearchTable" is the name of the nib file)

However, when I run this code and click on the record, nothing happens- the app doesn't crash, but the view doesn't get pushed. The code is getting run, because it works when I NSLog(), but it doesn't seem to be pushing the view.

Thanks for any help in advance.

A: 

You are really close, but did you tie the view in the nib file to the view field of the view controller?

alt text

EDIT: So the view is connected, and your code looks just fine. I just pulled a piece of my own code:

// show theme settings
ThemeController * theme = [[[ThemeController alloc] 
                            initWithStyle:UITableViewStyleGrouped] autorelease];
[[self navigationController] pushViewController:theme animated:YES];

Have you checked if self.navigationController is non-nil?

Couple of things I'd try at this point:

  • just hard-code the view to come up as the root view, verify it works
  • put a couple of NSLogs in the viewWillLoad, viewDidLoad, viewWillAppear in the client view controller

Best of luck.

Jonathan Watmough
Yes, I did... somehow, the view isn't pushing correctly.
Chromium
If it helps, the code that pushes the view is in the controller class of a UITableView that is in another view... so maybe that might be the issue.
Chromium
Fixed- I just realized that I wasn't working with a UINavigationController, just a UIView :)
Chromium