I want to inspect drawing of the views, I press debug view hierarchy, but the screen is empty
More precisely, doesn't show only one controller, that is the screen with one controller, other controllers normally draws. It is CollectionViewController and if in a code to put quantity of cells 0, then the controller is displayed in full
Related
I am new to storyboards and just learning swift. My document based app has a main document view where all the action is (user mouse clicks, keyDown, etc). It's size can vary based on either user menu command or model state changes. It also has subviews that may come and go. This needs to be the document view of an NSScrollview.
This document view needs its own view controller.
Starting with the main storyboard if I add a scroll view to the main view controller view, I can set my custom view to be the document view. But there doesn't seem to be anyway to give it it's own view controller, within the storyboard paradigm.
Previously, (under objective c, if that matters), I was able to create my document view and it's view controller in a XIB, then in code assign this document view to the NSScrollview's document view.
Presumably, I could still do this in code in Xcode 8/Swift 3, but isn't there a way to do it with storyboards?
Added Later: I seem to get close to what I want by replacing the scroll view's document view with a container view. I'm using a centering clip view, and apparently the container view cannot have constraints, or it defeats the centering!
I can then drag a new view controller onto the container view. The new view controller and it's view can be my custom view controller and it's custom view.
This looks like it will work OK, so far, but it seems a bit of a kludge to me. Is this the standard way to embed a custom view controller with its view in an NSScrollView?
I am presenting a modal view controller using UIPresentationController. I am setting the frame of presentedView less than the containView's bounds using following method:
override func frameOfPresentedViewInContainerView() -> CGRect {
let myDX = (self.containerView!.bounds.width - 600)/2
let myDY = (self.containerView!.bounds.height - 600)/2
return self.containerView!.bounds.insetBy(dx: myDX, dy: myDY)
}
Everything works great unto this point.
Now, I present another view controller modally (default not custom) on top of the currently displayed modal view controller which takes up the entire screen. So, I have a custom modal view controller underneath the default modal view controller that covers the entire screen.
The problem is when I dismiss the top view controller thats covering the entire screen, my custom view controller shows up covering the entire screen as well. I want my custom view controller's size to remain the same (smaller than containerView). Is there any way that I can achieve this.
Any help would be appreciated
I encountered the same issue. I couldn't solve it by adding constraints, and -[UIPresentationController containerViewWillLayoutSubviews] is called too late (after the dismiss animation is completed).
After some time I figured out that the problem seems to be that the presenting controller view is being removed from the view hierarchy when you present with the default UIModalPresentationFullScreen presentationStyle and added again with a full screen size when it has to be shown again.
In iOS 8, you can use UIModalPresentationOverFullScreen as the presentationStyle when presenting from the smaller controller. The system will not automatically remove the presenting controller's view then. (-[UIViewController viewWillDisappear:] and such, doesn't get called on the presenting controller when you do this though)
You can also use UIModalPresentationCustom which is available in iOS 7, but then you'll have to provide your own transition animation.
I have a View Controller that is presented when you first open the app, and I have another controller that can be shown on screen if you tap a button at the top of the screen. However, instead of doing it this way I was wondering if I can either drag the view down or tap the button and have an animation take care of that.
I have tried doing this with a PageView Controller, but this doesn't show the effect I wanted as it simply translates over to the next view and doesn't actually keep the initial view fixed in place while the second view slides over it.
Also, instead of a view controller would a view initially placed out of bounds in the main View Controller work? Thanks in advance!
You could use a side menu like MMDrawerController that has 4 type of animations for presenting the viewController.
Or you can create your custom UIView (not viewController) even using Interface Builder and animate that screen yourself. The animation can be started using UIScreenEdgePanGestureRecognizer.
I have a lot of view controllers in my Storyboard which makes navigation a bit difficult. When I click on a view controller or other item in the document outline, it will scroll automatically to the graphical representation of this view controller. However, when clicking on the graphical representation the document outline list does not automatically scroll to the selected item. I have to scroll through this list until I see something selected to know it is the correct one.
Is there a way to select a view controller in the graphical view, and let the document outline scroll to this view controller?
Another related annoyance is that if you filter the document outline to find the correct view controller, and click on that view controller, it will be scrolled away when you reset the filter again. Is there any way to prevent that from happening?
Is there a way to select a view controller in the graphical view, and let the document outline scroll to this view controller?
When clicking on an object (view controller, view, etc.) in a storyboard scene in the graphical editor in Xcode, Xcode 6 does scroll the hierarchical view so that the selected object is at least partially visible. Also, hierarchical list for that scene opens up so that you can see the object. So in the 2 years since you asked this question, at least that much has improved.
Another improvement: if you point to a view controller at the top of a storyboard scene in the graphical editor, a small view pops up with the name of the scene, which makes finding it in the list a little bit easier.
if you filter the document outline to find the correct view controller, and click on that view controller, it will be scrolled away when you reset the filter
This also seems to have improved: the selected view controller remains visible even after clearing the search field.
I am developering in iOS 5.1 and is pretty happy with these methods in UISplitViewControllerDelegate
splitViewController:willHideViewController:withBarButtonItem:forPopoverController
splitViewController:willShowViewController:invalidatingBarButtonItem:
however, now I notice that these two methods will be only called when the device is rotating and thus the orientation changes. What I am trying to do is to segue(replace segue) my detail view controller to another one. In the new detail view controller, I will always hide the master view controller even in landscape and therefore I need the button.
Without the delegate being called of these two methods, how can I get the button?
If you are hiding your master view controller even in landscape (by means of split view controller delegate), the splitViewController:willHideViewController:withBarButtonItem:forPopoverController: will be called, so you can safely put your code there.