Advertise here




Advertise here

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Sign In with Google Sign In with OpenID
Please do not post the same thing multiple times. The board software automatically flags certain posts as needing moderator attention. This happens the most often for new users. I'm pretty sure this is made clear at the time you attempt to post. Posting the same thing over and over again just makes that many more posts the moderators have to weed through later. This makes us sad. Don't make us sad. If your post/thread doesn't appear, just wait a while. Don't post it again. If it hasn't shown up by the next day, then you can try again. I normally go through posts in the mornings, and try to check a few times throughout the day, but I'm not here 24/7. There will typically be a significant delay before posts are approved. Just be patient.

NavigationController missing back button

kapps11kapps11 Posts: 718Registered Users
Hey guys -

so this seems like a really stupid problem that I should be able to fix but I cant figure it out for the life of me. So I'm just pushing a view controller onto a navigation controller, and that works fine, but THERES NO BACK BUTTON, and I cant figure out why because it usually puts on in for you. This may be something with the new iOS 4 stuff. but anyway ya any help would be great!!
Post edited by kapps11 on

Replies

  • CAMCAM Posts: 159Registered Users
    Can you give us some code and tell us where you put the navigationController
  • kapps11kapps11 Posts: 718Registered Users
    its just a basic nav controller with a table view that was setup by apple Navigation-Based app template. Then i just add the next view controller (ImageViewController is obviously a subclass of UIViewController):

    ImageViewController *imageView = [[ImageViewController alloc] initWithEntry:[self.entryArray objectAtIndex:indexPath.row]];
    [self.navigationController pushViewController:imageView animated:YES];
  • kapps11kapps11 Posts: 718Registered Users
    Nvm i figured it out, or fixed it anyway. I guess the way that apple sets it up, the navigation controller doesnt get a rootview controller, so when you try to puch your first one, it sets that as the root, therefore there is no back button. So in the app delegate, setting your root view controller as the view controller for it fixes the problem:"

    navigationController = [[UINavigationController alloc] initWithRootViewController:[[RootViewController alloc] initWithNibName:@\"RootViewController\" bundle:nil]];
  • vamsi.acvamsi.ac Posts: 105Registered Users
    kapps11;214769 said:
    Nvm i figured it out, or fixed it anyway. I guess the way that apple sets it up, the navigation controller doesnt get a rootview controller, so when you try to puch your first one, it sets that as the root, therefore there is no back button. So in the app delegate, setting your root view controller as the view controller for it fixes the problem:"

    navigationController = [[UINavigationController alloc] initWithRootViewController:[[RootViewController alloc] initWithNibName:@\"RootViewController\" bundle:nil]];
    thank you,,, worked for me too..
  • jpauloriojpaulorio Posts: 1New Users
    Instead of writing code you may also open the MainWindow.xib file in Interface Builder, select the Navigation Controller in the list which contains File's Owner, First Responder, etc, and in the Inspector on the View Controller Group select RootViewController for the NIB Name field. Then expand the Navigation Controller item until you find the "Navigation Item" item. Select it and in the Inspector fill the Title field. When you run your app you'll see a back button with the text you've typed in the Navigation Item's title field.
  • papaBpapaB Posts: 1New Users
    jpaulorio;291955 said:
    Instead of writing code you may also open the MainWindow.xib file in Interface Builder, select the Navigation Controller in the list which contains File's Owner, First Responder, etc, and in the Inspector on the View Controller Group select RootViewController for the NIB Name field. Then expand the Navigation Controller item until you find the "Navigation Item" item. Select it and in the Inspector fill the Title field. When you run your app you'll see a back button with the text you've typed in the Navigation Item's title field.
    Thanks! worked for me as well, I am working through Head First Iphone Development and it is a great book. Except it is still using iOS sdk 3.0 and an example uses Twitter API's basic authentication, which is deprecated.

    But this was the missing step. Thanks again!
Sign In or Register to comment.