SomeAndroidProgrammar
SomeAndroidProgrammar

Reputation: 41

Hide UINavigationBar 3D touch

I am trying to 3D peek and pop items in a UITableView. Everything works fine, except the target ViewController has a UINavigationBar which also shows.

I added my UINavigationBar to my ViewController code through Interface Builder and set self.navBar.isHidden to true which hides the UINavigationBar, but it leaves empty space equal to the size of the UINavigationBar.

Does anyone know how to hide the UINavigationBar properly?

Note: I am not using a UINavigationController, I simply added the UINavigationBar to my ViewController by drag/drop.

Upvotes: 0

Views: 186

Answers (1)

matt
matt

Reputation: 534893

the target ViewController has a UINavigationBar which also shows

Use a real UINavigationController plus UITableViewController (as its root view controller). This is an excellent way to have a navigation bar even if you never intend doing any navigation.

Here's a big advantage of doing that: You don't even need to hide the navigation bar when you peek! Use the UITableViewController alone as the peek navigation controller, and the UINavigationController when you pop. Thus, the preview won't have any navigation bar but if the user presses all the way and you do the real transition, the new view controller will have the navigation bar. Remember, no law says that the peek view controller must be the same as the pop view controller!

Upvotes: 1

Related Questions