0

I want to have a UISegmentedControl in/below the UINavigationBar of a UINavigationController which stays in the same position in case of a segue. This is the same effect as the bookmarks menu in Safari (iOS):

Safari Bookmarks Menu

With the approaches as described in these answers (similar as this explanation) I am able to show the UISegmentedControl in a toolbar directly below the UINavigationBar of the UINavigationController, but if the UINavigationController pushes a new UIViewController the toolbar and the UISegmentedControl which it contains are pushed off-screen.

What is the solution to force the UISegmentedControl to stay in the same position if the UINavigationController pushes a new UIViewController?

UPDATE 29 August: I also tried this CocoaCasts tutorial but that does not provide the required solution as I require a UINavigationController with the regular push animation and back button (like in the Safari Bookmarks Menu) and in addition a UISegmentedControl which stays in the same position when the UINavigationController pushes a new UIViewController (which push is not triggered due to a touch on the UISegmentedControl but, for example, due to a touch on a UITableView cell on the rootviewcontroller of the UINavigationController).

Bas
  • 1
  • 2

1 Answers1

0

You need to do this with View Controller Containment. Please follow this link.

  • Thanks for the suggestion. I did not mention this in my question (will add it now) but I already tried the approach as set out in that CocoaCasts tutorial but that does not provide the solution for my problem. In thas tutorial the UINavigationController is used to easily "switch" between the views linked to the UISegmentedControl (and therefore without any animation and without a back button). But I require the behavior as in the Safari Bookmarks Menu: a UINavigationController with the regular behavior of an animation in case of a push and with a back button + a fixed UISegmentedControl. – Bas Aug 29 '18 at 20:04