3
votes

I want to implement a ‘modal’ view like the ‘search’ view of the AppStore on the iPad.

When shown, it should:

  • Still show the tab bar. Selecting any of the items should take you to their view as normal.
  • No tab bar item is highlighted (because the search view is ‘modal’).

The closest I’ve come, with existing APIs, is:

  • On the ‘search’ view controller, set the UIModalPresentationCurrentContext modal presentation style.
  • Show ‘search’ view controller modal from the active view controller inside the tab bar controller (not from the tab bar controller itself).

However, this does not seem to be the right path:

  • View controller is shown underneath the status bar. I can work around that from -[UIViewController viewDidAppear:], but when changing the orientation of the device, this leads to all sorts of drawing issues and the controller, again, tucks itself underneath the status bar.
  • Tab bar item is still highlighted.
1

1 Answers

0
votes

to keep showing the search bar just trim the modal view's hight so that it doesn't cover the tab bar.

For orientation changes, you just need to handle that by changing the view size and making sure the modal view is always brought to the front of all the views. You can modify that view's frame and contents programmatically or you can just create nibs for the orientations you want to support and load them up when it changes. Also note if you do change the view's frame programmatically you will probably need to resize/reposition fields as well.

For dealing with the tab bar, you should be able to turn off the highlighted item. So when you pop up the modal also make sure to turn off the highlighted item. If you want to interact with the toolbar from the modal view you can do that with delegates, passing an instance of the parent view (or just accessing parent view... I think you get that for free)