UITableViewContent Inset messed up on iOS 8 - ios

I have a navigation controller with a UITabBarController as the initial view controller. Within that, I have two UIViewController's as sub-viewcontrollers in the tab bar controller. Both of my view controllers have UITableView's in them. The first one always looks fine. However, the second view controller always has a messed up content inset. I don't know why because there doesn't seem to be any difference in the way I setup my table views. I can manually set the content inset in viewDidLoad, but there's got to be a better way since it's working by default in the first view controller.
This is the first table view. As you can see, the the content offset looks fine.
Something to note: when opaque navigation bars are turned off, the issue goes away.
This is the second table view. As you can see there is a table view cell underneath the navigation bar.

I fixed the issue by changing the structure of my view hierarchy. Apparently I should not of had a UINavigationController as the initial view controller, but rather had the UITabBarController as the initial view controller and from there have UINavigationControllers within the tab bar where needed.

Related

How to fix incorrect (small) view on my main storyboard

So In my main storyboard one of my view controllers view is smaller than it should be, making that part of the UIView untouchable to the users... I don't know if its a tool bar or some weird inherited view from the previous view controller as it does have a relationship to the previous view controller
tried removing tool bar, I even put my tableview over top of the view making it bigger, but it is unusable on the iPhone after the build
I just need it removed, its a grey bar
I am going to assume that gray is being passed over to your present view controller, I would remove the segue to check if the view updates its constraints, if so remove the previous view controller and embed it to the previous to remove the bar

Animation bug with always displayed large titles after popping view controller

I wanted to use the new Large Titles with largeTitleDisplayMode set to .always but got some strange animation issues while popping the pushed detail controller if the root UITableView's contentOffset.y is positive aka scrolled.
So this is how it should work:
And this is how it works after scrolling:
I guess it's a bug, but maybe anyone have a workaround till it's fixed?
To reproduce, create a new sample project, open Storyboard and do the following:
Add Navigation Controller and tick it's Navigation Bar's Prefers Large Titles value
Select it's Root View Controller and set it's Table View's Content to Static Cells.
Add many static cells or make then big enough, so your Table View become scrollable
Add a View Controller as detail view controller and setup the Show segues
Setup the Navigation Item's Large Titles property to Always for both view controller
Run the app, scroll to the bottom, perform a show/push segue and pop back

What is actually inside navigationController's "view" property?

I was going through Apple's documentation about navigation controller and find this point ambiguous and hard to comprehend.
It was written in this online documentation of navigation controller.
Navigation Controller Views
A navigation controller is a container view controller—that is, it
embeds the content of other view controllers inside of itself. You
access a navigation controller’s view from its view property. This
view incorporates the navigation bar, an optional toolbar, and the
content view corresponding to the topmost view controller. Figure 2
shows how these views are assembled to present the overall navigation
interface. (In this figure, the navigation interface is further
embedded inside a tab bar interface.) Although the content of the
navigation bar and toolbar views changes, the views themselves do not.
The only view that actually changes is the custom content view
provided by the topmost view controller on the navigation stack.
From that, my understanding is that inside this "view" property. There should be at least two subview inside this view.One is the navigationBar the other is the contentView of the current displayed viewController’s view. But while I am debugging only the navigation bar showed with another view called UINavigationTransitionView showed.
My question is, is this normal. Have I done anything wrong?
Second, what is the most common way to access current displayed viewController's view with only the reference to the navigation controller.
Thanks
UINavigationTransitionView controller contains one wrapper view which intern will have the current uiviewcontroller's view.
You can probably find this view as a subview of UINavigationTransitionView. However this is not the "right" way to do this. The proper way is to go through property "topViewController" and then take its view:
self.navigationController.topViewController.view
If there is another view controller or its view that you need, you have access to whole view controller's hierarchy across navigation controller through viewControllers property.
self.navigationController.viewControllers
More here:
https://developer.apple.com/library/prerelease/ios/documentation/UIKit/Reference/UINavigationController_Class/index.html

Using iOS 6 autolayout, what would be the proper way to display somthing above an UINavigationController?

In my app, i have a main view controller which sometimes brings a modal view on top of it. This modal view is a UINavigationController with a navigation bar. I want to display an image above the navigation bar, and have the navigation bar appear below the image.
I do not want to subclass anything and the app uses autolayout, i do not want a bunch of delegate callbacks and frame calculations. The view inside the navigation controller (the actual modal content) must still respond to different screen sizes correctly, such as rotation, call status bar etc. Also, no IB solutions please, these views are all managed in code.
How do i accomplish this?
I would turn off AutoLayout and place the image at the top
I don't think you can do it with your modal view being a navigation controller. I would do it by making that modal controller a UIViewController that you set up as a custom container controller. You can add an image view to the top of this controller's view and add the view of a child view controller (which would be a navigation controller) to the bottom. This would be a lot easier to do in a storyboard using container views, but it certainly can be done in code.

TableView as subview with navigation controller

I would like to have a view (one of five tabbars) with some subviews (labels, images and such) including a table view, so that the table view will only take up half of the screen (similar to this thread Add tableview as subview to view?). I have set up the views controller as tableview delegate and data source, but how can I use navigation with this table view (uinavigationcontroller)?
Clarification:
I started out with a tab bar based app, and wanted to have one of the tab bar views to have some labels in to top and a table view in the lower half of that view. I solved it myself, see below
This was of course simpler than I thought it was. I set up a tab bar controller with some tabs (with individual view controllers). I embedded one of the view controllers in a navigation controller (using the menu Editor -- Embed in -- Navigation Controller). Added the labels and a uitableview (through Storyboard) to the view and hooked up outlets for the labels and the table view, as well as setting the view controller as delegate and data source (UITableViewDelegate, UITableViewDataSource).

Resources