Loading views into NSContainerView with swift
I have a storyboard setup with the main view having a bunch of buttons and a container view and I would like for a different view to be loaded into that container view each time I press one of those buttons, kind of like a tab view controller works but without using one of those.
Also, later on I plan to have buttons inside those views that load other views replacing the views themselves.
Anyone can give me some hints?
- How to add a sandboxed app to the login items
- Attaching to a remote process for debugging
- How does OS X load a storyboard based app, and how does it do window management?
- Compile libogg for iOS using Xcode5.1 error
- OpenGL depth problem
- Setup that allows a child NSManagedObjectContext to Fetch when it's parent context is Saving
Solutions Collect From Internet About “Loading views into NSContainerView with swift”
“Container View defines a region within a view controller’s view subgraph that can include a child view controller. Create an embed segue from the container view to the child view controller in the storyboard.”
You mentioned NSContainerView, so I assume you’re trying to do this on macOS, not iOS. Here’s a useful article and code project (for iOS 6, but I was able to set up switchable subviews in iOS 9 using this as a guide):
The important bits are using the embed segue, then wiring the view controllers together through a combination of viewDidLoad and prepareForSegue, and then finally loading one of the switchable view controllers (say one for each of your buttons) from the storyboard, where they are not connected to anything else.
- UIView group opacity in single view heirachy
- How can I use C++ with Objective-C in XCode
- iOS UI Testing On an Isolated View
- Error while using CoreSpotlight
- What is the NSObject isEqual: and hash default function?
- Getting Optional(“”) when trying to get value from KeyChain
- UIScrollview with UIButtons – how to recreate springboard?
- UItabBar changing View Controllers
- Push another View in UINavigationController?
- Autolayout, UIDynamics and animations
- Replace blue dot in GMSMapView by an arrow – Swift
- Adding strings localization files from a server
- Why can't Swift initializers call convenience initializers on their superclass?
- Xcode thinks a remote svn repos is git
- Generic protocol for basic types