views:

69

answers:

1

Ok, this is an odd one and I can reproduce it with a new project easily.

Here is the setup:
I have a UISplitViewController. In the left side I have a UITabBarController. In this tab bar controller I have two UINavigationControllers. In the navigation controllers I have UITableViewControllers. These table views have search bars on them.

Ok, what happens with this setup is that if I'm in portrait mode and bring up this view in the popover and I start a search in one of the table views and cancel it, the navigation bar becomes unresponsive. That is, the "back" button as well as the right side button cannot be clicked.

If I do the exact same thing in landscape mode so we are not in a popover, this doesn't happen. The navigation bar stays responsive.

So, the problem only seems to happen inside a popover.

I've also noticed that if I do the search but click on an item in the search results which ends up loading something into the "detail view" of the split view and dismissing the popover, and then come back to the popover and then click the Cancel button for the search, the navigation bar is responsive.

My application is a universal app and uses the same tab bar controller in the iPhone interface and it works there without this issue.


As I mentioned above, I can easily reproduce this with a new project. Here are the steps if you want to try it out yourself:

  • start new project - split view

  • create new UITableViewController class (i named TableViewController)

    • uncomment out the viewDidLoad method as well as the rightBarButtonItem line in viewDidLoad (so we will have an Edit button in the navigation bar)

    • enter any values you want to return from numberOfSectioinsInTableView and numberOfRowsInSection methods

  • open MainWindow.xib and do the following:

    • please note that you will need to be viewing the xib in the middle "view mode" so you can expand the contents of the items

    • drag a Tab Bar Controller into the xib to replace the Navigation Controller item

    • drag a Navigation Controller into the xib as another item under the Tab Bar Controller

    • delete the other two view controllers that are under the Tab Bar Controller (so, now our tab bar has just the one navigation controller on it)

    • inside the navigation controller, drag in a Table View Controller and use it to replace the View Controller (Root View Controller)

    • change the class of the new Table View Controller to the class created above (TableViewController for me)

    • double-click on the Table View under the new Table View Controller to open it up (will be displayed in the tab bar inside the split view controller)

    • drag a "Search Bar and Search Display" onto the table view

    • save the xib

    • run the project in simulator

      • while in portrait mode, click on the Root List button to bring up popover

      • notice the Edit button is clickable

      • click in the Search box - we go into search mode

      • click the Cancel button to exit search mode

      • notice the Edit button no longer works


So, can anyone help me figure out why this is happening?

Thanks,

Mark

A: 

Ok, got an answer from Apple Developer Technical Support. They investigated it and found it is a bug in the UIPopoverController. He gave me a workaround that kind of works but the right button in the nav bar ends up sliding across the screen after canceling the search. But, at least it fixes the issue. He also suggested I send in a bug report to Apple and I've done that as well. Hopefully they will fix this in the next version of the SDK.

Here's a copy of the relevant portion of the Apple engineer's response:

I've created my own project and dipped into what is going on and it looks like it's a bug in the UIPopoverController where after the UISearchBar is being dismissed, something is being obstructed in the navigation bar.

There's a workaround that I've found for now, though the animation that occurs is not amazingly optimal: - Use the – searchBarCancelButtonClicked: method of UISearchBarDelegate and add the following:

self.navigationItem.rightBarButtonItem = nil;
self.navigationItem.rightBarButtonItem = self.editButtonItem;

As I said, it looks like the popover is pushing the button onto the navigation bar, so it may not be what you're looking for.

Mark