Popover with UINavigationController/UITableViewController cropping nav bar - ios

I've implemented a Popover that is composed of a UINavigationController that has a UITableViewController embedded. When the popover comes up, the navigation bar is cropped on the top and sides. I've attempted to use solutions I've read here with forcing the size - setting it to CGRectMake(0,0) then to the right size on ViewWillAppear and ViewDidAppear but it has no effect. The UINavigationController and UITableViewController have Size as Freeform in the Simulated Metrics (although I've tried Inferred, to no avail as well). I've tried setting the popover size to an explicit size, still no go. It ignores all of my attempts to make it look right.
What is the key to making a popover look good with a dynamic TableView?
TIA!

I've resolved this problem. I removed embedding of the UITableViewController in a UINavigationController and instead added a UINavigationBar to the header of the UITableView. The view appears correctly now with correct sizing of the navigation bar and buttons.

Related

Increasing UINavigationController navigation bar height in Landscape mode

I have seen too many posts on this but unable to find satisfactory answer to this question. Specifically, I want to increase the height of navigation bar of UINavigationController by around 20 pts when iPhone is in landscape mode (not otherwise), and also set a custom image for it's Background. What I have found so far:
Manipulating frame of UINavigationBar managed by navigation controller,
Hacks such as sizeThatFits along with subclassing UINavigationController -- doesn't work for me in iOS 12 and also it is a kind of hack,
Hide the default navigation bar in UINavigationController and instead replace it with a custom navigation bar. But I don't see any sample code. Any sample code will be appreciated.
Edit: Here is how I want my custom navigation bar to look like that works across UINavigation hierarchy.

Common blur effect for top tool bar and navigation bar

I have many ViewControllers inside one NavigationController. In one of ViewControllers I should show toolBar below navigationBar. If simply add it to ViewController with necessary coordinates I have this:
But here is separator between NavigationBar and ToolBar.
If I set clear background and shadow images and set blur effect for navigationBar it is a problem with different blur effects in navigationBar and toolBar:
So is it resolution when there is no imagesShadow in navigationBar and there is common blur effect?
I resolve my problem. Idea of resolution make NavigationBar and ToolBar fully transparent. Next On every ViewController in place of bars and below them I put UIVisualEffectView with common height of bar or bars. So UIVisualEffectView simply should be the highest subview of rootView of ViewController. And here is a problem in case of using UITalbeViewController UITabBarController and so on. In my situation there was only UITalbeViewControllers. Firstly I try to use this resolution. But I had problems with creating of multiple subviews wile navigation via different ViewControllers. Finaly I restructure storyboard. Every TableViewController I have replaced by ViewController with rootView simple view. TableView was subview of rootView. Also I put there VisualEffectView. I have done it for every TableViewControllers.
Here is a sample of structure:
I think there is there better resolution but currently this is optimal.

TableView Scrolls Over NavBar

When I scroll my TableView, it scrolls over my navigation bar (which I made without using the built in navigation bar for various reasons). See below:
Unscrolled:
Scrolled up:
How do I make it so that the TableView scrolls under the Navbar?
SOLVED:
I checked the "clips subviews" box for the table view to fix this problem.
To me, it looks like there may be an issue with your view hierarchy. Now, I assume that you built your own navigation bar by subclassing UINavigationBar.
In order to get the kind of behavior you need, you should have the following:
UIWindow's rootViewController is an instance of UINavigationController.
UINavigationController.navigationBar = your subclass of UINavigationBar.
UINavigationController.viewControllers[0] = UITableViewController
The UITableViewController.view = your UITableView

UITabBarController in storyboard hides content of UITabBarItems

I am a beginner using storyboards for iOS. I have been using the tab bar controller to show my content.
When I first implemented the UITabBar I could see all the icons at the bottom of the UITabController in storyboard and I could see the UITabBarItem at the bottom of each UIViewController. Why is there now a blank grey bar? I can't seem to change the content either in storyboard. I tried adding another UITabBarController but got the same problem, it also has a dark grey bar at the bottom. However when I run the app all the icons appear. How do I fix this so I can see the UITabBarItems in storyboard or should I just try updating them programmatically instead?
Showing a tab bar or not is one of the couple of simulated metrics used in Interface Builder. As such they only serve to have an idea of how your controller would look under different conditions but do not really change anything to the actual controller.
Most of the time the default Inferred option will try to deduce from the Storyboard configuration how it should look like. In your case just connect the tab bar controller to your controller through the viewControllers outlet.
In contrast, below you have some View Controller properties that change both how your controller is previewed in Interface Builder and also its actual behavior (for instance try changing Adjusts Scroll View Insets or Extended Edges).

Animate Controls down with change to UINavigationBar

I have a UINavigationController with standard UINavigationBar. When presenting certain UIViewControllers and orientations, the UINavigationBar may or may not appear and it may or may not have a prompt element. This means that the bar height changes frequently.
I have some subviews below the UINavigationBar set with NSLayoutConstraints to topLayoutGuide. It generally lays out as expected, adjusting vertical position of the subviews appropriately based on the height of the UINavigationBar. What it does not do is move the subviews at times when the UINavigationBar is animated after the view is already displayed.
Specifically, coming from a state with UINavigationBar hidden, transition to a UIViewController which does not hide the navigation bar to one which does. The view displays, then navigation bar animates into place. The subviews do not move down. If I rotate the device, every things lays out appropriately again. Only when animating the navigation bar in and out or to display/hide the prompt I not find a hook to reevaluate the constraints.
I tried [self.view updateConstraints] and [self.view updateConstraintsIfNeeded] in various places such as viewDidAppear, viewDidLayoutSubviews. Nothing seems to update that topLayoutConstraint.
I am familiar with edge restraints, translucent navigation bar and other various methods of keeping the entire view from appearing under the navigation bar. I do want to keep view full size and I want the translucent bar so these are not solutions for me. It seems the constraints should handle this automatically, hence the "auto" in auto layout.
To simplify, for recreation, UINavigationController with rootViewcontroller showing normal navigation bar with just a title. In viewDidLoad of the next presented viewController I have [self.navigationContoller setPrompt:self.myPrompt]. The view is presented, when the prompt is set, the navigation bar grows larger. Some labels below the bar are set with relation to topLayoutGuide, which places them correctly initially. I expect they would move down when the bar grows. Rotate device back and forth, they now layout correctly. Pop the viewController and push back to top, repeats as above.
So, it turns out it was all me. After trying all manner of forcing layout updates in all sorts of ways, the solution was to move the [myView setPrompt:myPrompt] out of viewDidLoad and call it in viewDidAppear instead.
Works completely as expected. Navbar grows, subviews shift and shrink as needed. Now I have to hunt down all the experimental code I plastered everywhere trying to do it wrong.

Resources