I'm following the SwiftExample from JSQMessagesViewController but attempting to place the ChatViewController into a container view controller. It works as expected except that the text input toolbar does not show at the bottom.
I have experimented with sizing and looking at the hierarchy debug view to see if the input toolbar may be hidden offscreen, but it does not appear to exist. The toolbar is part of the JSQMessagesViewController xib file. Why would it not show?
UPDATE:
I see that jsq_configureMessagesViewController explicitly removes the inputToolbar from the view. If I comment out that line as an experiment I get the toolbar to appear, however it then fails with an error regarding having the wrong parent in the view hierarchy.
So obviously there are things I do not yet understand about input views and the view hierarchy. This thread seems related:
Terminating app due to uncaught exception 'UIViewControllerHierarchyInconsistency',
and for what it's worth here is my storyboard showing the container:
Storyboard diagram
The problem seems to be unique to the current development branch. Reverting to an earlier release seems to work.
Related
When I compile and run my tvOS project with the new Xcode13+, the tab bar scrolls with the scrollView, and I can't access the split view controller moving the focus.
The issue doesn't happen with Xcode < 13. However, after updating to Monterey, I don't have a choice.
Pre-condition:
Create an app on tvOS with a tab bar controller;
In one of the tab, put a split view controller;
In the collapsed master view controller, put a table view.
Issue 1:
Observe that moving the focus towards the left to open the collapsed master view controller, doesn't work anymore. The master view controller won't be pulled out. The only way to pull it out is to tap the back button (ex menu button).
Issue 2:
Scrolling down on the tableView in the master view controller would also scroll away the tab bar at the top (this was possible only setting the tabBarObservedScrollView before, but now is deprecated and it happens automatically. Even using [self setContentScrollView:nil forEdge:NSDirectionalRectEdgeAll] doesn't help.
Did anyone get the same problem? Do you know why this happens and if it can be solved?
In the meantime, I reported the problem to Apple.
PS. another odd thing is that the Apple documentation for setContentScrollView:forEdge: is empty (as of today).
Update:
Observe how even setting the property to nil, it is still populated:
After deeper investigation, I found that the problem happens only when compiling with Xcode13+ and running on tvOS15+.
For some reason, the property above is automatically populated for ALL UITableViewController.
Replacing the UITableViewController with a UIViewController with a UITableView inside solves the Apple issue.
This is a bug with Apple SDK:
Observe how even setting the property tabBarObservedScrollView to nil, it is still populated:
This happens for ALL UITableViewController.
Replacing the UITableViewController with a UIViewController with a UITableView inside wor the Apple issue.
--
Regarding the swipe left, it's another Apple bug or decision to not allow the focus to move on the master view controller when on a split view controller.
I have a very big problem with View hierarchy debugger in Xcode. This is my only project in which I have this behavior. When I capture the view hierarchy I only see frames and anything else. I already tried the "Adjust view mode" setting, but with no results. It is set on "Wireframes and Contents", but I can't see contents... My project is built with only one storyboard (Main.storyboard) which houses the UINavigationController and the initial view controller of the app. The rest is built with programmatic layout. Didn't find nothing on internet. Do you have any solution? Only system images (SFSymbols) appear.
After more than a year, I decided to try again to solve this problem. I finally solved it! With the latest Xcode releases, when I start the view hierarchy debug tool, an error appears and something is logged in the console. I use a subclass of CAGradientLayer in this screen and a fatal error occurs because I have not implemented the init(layer:) initializer.
I have solved my issue by implementing the method. Now everything works fine!
I'm got a problem with a view controller which is holding some subviews. My view controller always shows position ambiguous if I added any other views so it makes my view controller cannot show full screen. I'm using View Debugging of XCode to know that warning error. But if the view controller blank, it's work like the bug never happened. This is so weird and I never see it for 4 years working with iOS. Did anyone know about this issue before and how to fix it?
when I add just one view inside:
And result:
And when I just set background for this viewcontroller
I am making an iPad app that, among other things contain a view in which to set options.
This "Options" View has two container-views, each holding a TableView with two different kinds of options in them, and switches to turn these options on or off.
The problem is that when I try to make a button from my main ViewController that will open the options view, I get the following error:
Screenshot of signal SIGABRT error
with this in the output:
Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: '-[UITableViewController loadView] instantiated view controller with identifier "UIViewController-c2d-Su-6Id" from storyboard "Options", but didn't get a UITableView.'
I don't know why the underlying function [UITableViewController loadView] is used, as I do not expect my Options-view to be a TableView - the tables are in container views.
I am using different storyboards, and a segue to a storyboard reference to present the Options View modally. I have tried deleting both the button, the segue and the Storyboard reference, replacing them with new ones, and renaming my ViewController.swift file, and all the references to it, with no luck
I have also tried looking for other solutions here on the site, but I have had no luck, and I begin to fear it might be because of the tableViews in the containerViews...
I am quite new to learning swift and Xcode, so please keep your explanations simple to follow, and assume that I am completely incompetent :-)
I'm guessing you probably added a Container View, which automatically places a "child" view controller onto the Storyboard, and then simply changed the Class of that child VC to UITableViewController --- which, as you found out, doesn't work.
To use a table view controller as the child, add your Container View, then add a normal UITableViewController to the Storyboard. Then, Ctrl-Drag from the Container View to the new table view controller and select Embed from the popup menu.
I'm trying to implement (what I thought would be) a straightforward, full-screen, four-pane iPad app interface by using container views. I have a simple root UIViewController containing a single view, in which are four container views, each with an embedded view controller (two panes each having a UITableViewController, and two panes each having a UIViewController). This was a breeze to create in Interface Builder, but when I run the app I get the following errors, apparently when the first embed segue is performed (i.e., after prepareForSegue is called with the embed segue for one of the two UITableViewControllers, but, apparently, before viewDidLoad is actually called on that UITableViewController):
* Assertion failure in -[UIStoryboardEmbedSegue perform], /SourceCache/UIKit_Sim/UIKit-2380.17/UIStoryboardEmbedSegue.m:18
* Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'containerView is required.'
Has anyone got a clue what I'm doing wrong? I can't seem to find any mention of this "containerView is required" error anywhere.
Thanks!
Well, I figured it out, and it had nothing to do with container views. Rather, I was inadvertently reusing a navigation controller subclass that I developed for the iPhone version of the app as the root view controller of the iPad version; and since a navigation controller does of course need a container view (which the root view controller in the iPad version does not have), it resulted in the error given. I'm leaving this up here in case anyone else encounters this rather cryptic error and made the same mistake I did!