Why would UIBarButtonItems simply not show up?

  • I have a screen that can be flipped over to show a map, and from the map
    the user can invoke a detail controller for an item on the map.  So I
    instantiate a navigation controller, make the map controller its root-view
    controller, and then invoke it:

    - (void)showMap

    {

    StashMapController* mapController = [[StashMapController alloc]
    initWithNibName:@"StashMap" stashes:_ownedStashes];

    mapController.delegate = self;

    UINavigationController* mapNavController = [[UINavigationController alloc]
    initWithRootViewController:mapController];

    [mapController release];

    mapNavController.modalTransitionStyle UIModalTransitionStyleFlipHorizontal;

    // Do flip transition.

    [self presentModalViewController:mapNavController animated:YES];

    }
    In the map controller's viewDidLoad, I add two bar-button items as the
    right buttons:

    UIBarButtonItem* globeButton = [[UIBarButtonItem alloc]
    initWithImage:[UIImage imageNamed:@"globe_white"]
    style:UIBarButtonItemStyleBordered target:self action:@selector(zoomOut:)];

    UIBarButtonItem* homeButton = [[UIBarButtonItem alloc]
    initWithImage:[UIImage imageNamed:@"location-arrow_white"]
    style:UIBarButtonItemStyleBordered target:self action:@selector(home:)];

    self.navigationItem.rightBarButtonItems = [[NSArray alloc]
    initWithObjects:globeButton, homeButton, nil];

    They're allocated, but they just don't show up.  Adding one of them as a
    single button doesn't work either.

    Setting *self.navigationItem.title* DOES work, so I know I'm dealing with
    the right structure.

    Any insight appreciated!

    Gavin
  • Ugh, never mind.  The graphic files hadn't been added to the project.  I
    would've expected a warning message to the console or a blank button, but
    got neither.
previous month july 2012 next month
MTWTFSS
            1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 29
30 31          
Go to today