Toolbar barbutton icon(pagecurl) not loaded

I am loading a mapview. I have created a barbutton in the bottombar toolbar of the view, setting its identifier as pagecurl. As expected, a barbutton with page curl icon is loaded. From this mapview I move to anotherv view, by clicking on annotations in the mapview. And then I return to the mapview. At that time my pagecurl barbutton icon(pagecurl icon) is not displayed, and my barbutton width is also reduced. I am not able to figure out the problem.

- (void)viewDidLoad
    [super viewDidLoad];

        [self.navigationController.navigationBar setBarStyle:UIBarStyleDefault];
        self.navigationItem.leftBarButtonItem = self.cancelButton   ;
        [self.cancelButton setTarget:self];
        [self.cancelButton setAction:@selector(onClose:)];

        [addressFieldSearchBar setFrame:CGRectMake(66, 0, 256, 44)];
        addressFieldSearchBar.delegate =self;

        [self.navigationController.navigationBar setBarStyle:UIBarStyleDefault];
        [self.navigationController.navigationBar addSubview:addressFieldSearchBar];

        [searchDirectionSegmentedControl addTarget:self action:@selector(segmentAction:) forControlEvents:UIControlEventValueChanged];
        UIBarButtonItem *searchDirectionSegmentedButton = [[UIBarButtonItem alloc] initWithCustomView:searchDirectionSegmentedControl];

        flexibleSpace = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemFlexibleSpace target:nil action:nil];
        NSArray *toolbarItems = [NSArray arrayWithObjects: compassButton , flexibleSpace, searchDirectionSegmentedButton, flexibleSpace, pageButton, nil];
        [self setToolbarItems:toolbarItems];

        self.navigationController.toolbarHidden = NO;
        [compassButton release];
        [pageButton release];
        [searchDirectionSegmentedControl release];

        mapView = [[MKMapView alloc] initWithFrame:CGRectMake(0, 0, 320, 480)];

        [self.view addSubview:mapView]; 

- (void)viewDidUnload{
    [super viewDidUnload];    

-(void) viewWillAppear:(BOOL)animated{
        [self.navigationController.navigationBar setHidden:NO];
        [self.navigationController.toolbar setHidden:NO];
        [self.navigationController.toolbar setBarStyle:UIBarStyleDefault];
        [self.addressFieldSearchBar setHidden:NO];

-(void) viewWillDisappear:(BOOL)animated{
        [self.addressFieldSearchBar setHidden:YES];
        [self.navigationController.toolbar setHidden:YES];


Though its a long shot, it could be something to do with the setHidden calls in your appear and disappear methods.

[self.navigationController.toolbar setHidden:YES];
[self.navigationController.toolbar setHidden:NO];

The best way to do this using UIViewController's "-setHidesBottomBarWhenPushed:" method.

Maybe try some NSLog() in -viewWillAppear:

// If pageButton is an instance variable

// Enumerate through all toolbar items.
// Check to see if NSLog output differs after pushing/popping this view controller.
for (UIBarButtonItem *item in [self.navigationController.toolbar.items])

Need Your Help

Finding the maximum area of three XY points in an array of XY points

c++ arrays object compiler-errors

I'm trying to find the maximum area using three XY points in an array of XY points in the form of (X,Y).

grep something with xargs and find

bash shell grep find

bash guru ;) I'm trying to improve some string in bash which grep specific keyword's matches in specific files. It looks like that:

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.