tags:

views:

32

answers:

2

I want to have the default shape of the back button, but that makes my program enter a loop at some point. The code is this for modifying the text of the back button, written before the initialization of the view.

UIBarButtonItem *newBackButton = [[UIBarButtonItem alloc] initWithTitle: @"Back" style: UIBarButtonItemStyleBordered target: nil action: nil];

[[self navigationItem] setBackBarButtonItem: newBackButton];

[newBackButton release];

can I also change the target to another view? I really need that default shape and I don't know how else to get it. Thanks!

+1  A: 

The UINavigationController does not work that way, you'll need to make a custom UIBarButton with an image.

christo16
A: 

If you want to customize the right-button in the navigation controller you usually set the backBarButtonItem on the parent view controller, i.e. the one you are going back to.

    parentViewController.navigationItem.backBarButtonItem =
    [[[UIBarButtonItem alloc] initWithTitle:@"Back"
                                      style:UIBarButtonItemStyleBordered
                                     target:nil action:nil] autorelease];
Mike Weller