I'm manually managing a UINavigationBar for my view. The Bar itself and the first UINavigationItem are created in Interface Builder. In my code, based upon various events, I push new navigation items onto the bar and paint the appropriate views as subviews of the main view. It all seems fine, but when I select the navbar back button, two items are lopped off the items stack, rather than 1 as I would have expected. To test, I set my controller as the delegate for the bar and trap 2 delegate methods:
- (BOOL)navigationBar:(UINavigationBar *)navigationBar shouldPopItem:(UINavigationItem *)item;
and
- (void)navigationBar:(UINavigationBar *)navigationBar didPopItem:(UINavigationItem *)item;
I found right before the pop, the items in the nav bar is correct, for example, 3. In the second method, just after the pop, the items is 1, even though the item popped is the last item - somehow the middle item is missing. I'm stumped as to how to debug this and would appreciate any ideas.
Note that I'm not using a navigation controller for various reasons.