tags:

views:

958

answers:

2

Hello I have a ABPeoplePickerNavigationController, on creation is set its navigationBar hidden.

peoplePickerController.navigationBar.hidden = YES;

This works perfectly, the only problem is that when the user taps the search box to search for a person, as he return's from the search, the navigationBar is re-displayed,. How can I get notified of this and make the navigationBar hidden again ?

I also think this is an apple bug, since on regular cases when search is tapped, the navigation bar is hidden to make for more room, and later displayed, but it does not take into account the fact that the bar could have been hidden in the first place.

Any trick's welcomed.

+1  A: 

If you believe this is a bug you should submit it to http://bugreporter.apple.com.

To me it also sounds like a bug, but I'd double-check with the documentation to make sure. If it doesn't mention anything, then I suggest reporting the bug.

Edit: On the other hand, I would think setting the navigation bar here to be hidden is a bad idea. Is there a particular reason for wanting to hide it?

jbrennan
I've got another navigation bar already doing what this one does. This is becouse I couldn't modify the one that came with the controller, its really annoying not being able to modify the ABPeoplePickerNavigationController usage.
daniel
+3  A: 

The safest and simplest method is to track when the keyboard hides/shows.

- (void)keyboardWillHide:(NSNotification *)notification
{
    peoplePickerController.navigationBar.hidden = YES;
}

- (void)hideNavbarAndKeepHidden
{        
    peoplePickerController.navigationBar.hidden = YES;
    [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(keyboardWillHide:) name:UIKeyboardWillHideNotification object:nil];   
}

- (void)dealloc
{
    [[NSNotificationCenter defaultCenter] removeObserver:self];
    [super dealloc];
}
rpetrich
Sir, you just won yourself 100 reputations points, thanks a lot :).
daniel
You're very welcome. And as the other commenter mentioned, it is indeed a bug and should be filed with Apple (include a simple test project for best results)
rpetrich