Unboxing iOS: Views outside the ViewController and at the top of the scene (between the First Responder and Exit fields)

I find it difficult to understand why you can put UIViews outside the UIViewController in the storyboard, and what a use case might be.

For example, on a storyboard, I can add UIToolbar , UIAcitivtyIndicator and UIProgressView , which is outside of the UIViewController . UIViewController this mean that you can link to Views that are outside of the UIViewController and potentially display them in some programmatic way or embed those that you would do using ContainerView ?

enter image description here View storyboards

+8
ios uiviewcontroller uiview storyboard
source share
1 answer

Yes, it is absolutely possible to do what you describe!

When you add objects that are outside the view controller, they appear in what Apple calls the "Scene Dock". Apple offers the following suggested uses for the scene:

If the view is not part of the hierarchy of the main view — for example, a popup menu — add a view to the scene dock. In a running application, the system adds and removes these views from the view hierarchy when they are open and closed.

The following are the steps to complete this work:

  • Open the storyboard.

  • Open the utilities area for the workspace window by clicking the utilities in the Toolbar.

  • In the Utilities area, select the Object library by clicking the Object Library button in the libraries panel.

  • On the storyboard, select the scene to which you will add an additional view.

  • Drag a view class object from the object library to the scene dock.

And what's important ...

The added view is part of the view controller. It will be created along with the rest of the species. You can attach a view to a view controller property that has an IBOutlet. You can add more than one look at the scene of a scene.

(These steps were originally copied from here - unfortunately, this page seems to have been deleted by Apple at some point).

+8
source share

All Articles