how do i get the navigation bar to show up on a tableview?

Discussion in 'iOS Programming' started by Chirone, Sep 17, 2009.

  1. Chirone macrumors 6502

    Joined:
    Mar 2, 2009
    Location:
    NZ
    #1
    how do i get the navigation bar to show up on a table view?
    i'm not using the tableview template
    i made the table view controller myself
    the table view and table view controller are set up exactly how it is in the template but it doesn't show up...
    (ie, i made the file's owner set to the table controller's class, i linked the table view to the file's owner's view, and set it as the datasource and delegate)

    clicking on a row in the table makes that row permanently highlighted until another row is highlighted, unlike the one that is from the template where it highlights like a button

    needless to say when i select a row, even though the code gets fired, the view doesn't change to another view as it should, even though the commented out code is uncommented


    all the tutorials on how to do this 'drill down' table start from the table view template, so none of them are any help
     
  2. dejo Moderator

    dejo

    Staff Member

    Joined:
    Sep 2, 2004
    Location:
    The Centennial State
    #2
    You need to use a UINavigationController and set your tableViewController as the root view controller.
     
  3. Chirone thread starter macrumors 6502

    Joined:
    Mar 2, 2009
    Location:
    NZ
    #3
    correct

    one more thing... this should also be easy

    when the row is touched, it's permanently highlighted. how to i make it highlight temporarily like other table views?
     
  4. Darkroom Guest

    Darkroom

    Joined:
    Dec 15, 2006
    Location:
    Montréal, Canada
    #4
    deselectRowAtIndexPath:animated:


    i'll use the example from Erica Sadun's iPhone Developer's Cookbook (Chapter 5: Basic Tables, Page 152):

    Code:
    - (void)deselect:(id)sender
    {
    [tableView deselectRowAtIndexPath:[tableView indexPathForSelectedRow] animated:YES];
    }
    
    //Respond to user selection
    -(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)newIndexPath
    {
    printf("User selected row %d\n", [newIndexPath row] + 1);
    [self performSelector:@selector(deselect:) withObject:nil afterDelay:0.5f];
    }
    
     
  5. Chirone thread starter macrumors 6502

    Joined:
    Mar 2, 2009
    Location:
    NZ
    #5
    thanks! worked right...

    and thanks for the resources too!
     

Share This Page