Xojo Conferences
XDCMay2019MiamiUSA

Platforms to show: All Mac Windows Linux Cross-Platform

NSViewControllerMBS.Constructor
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method Cocoa MBS MacBase Plugin 11.2 Yes No No Yes, macOS only No
Function: The constructor creating a new view controller.

Feedback, Comments & Corrections

NSViewControllerMBS.dismissViewController(ViewController as NSViewControllerMBS)
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method Cocoa MBS MacBase Plugin 18.4 Yes No No Yes, macOS only No
Function: Dismisses a presented view controller, using the same animator that presented it.
Notes: In macOS, this is the universal way to dismiss a view controller, no matter how it was presented.

Feedback, Comments & Corrections

NSViewControllerMBS.loadView
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method Cocoa MBS MacBase Plugin 18.4 Yes No No Yes, macOS only No
Function: Explicitly load the view now.
Notes:
This method connects an instantiated view from a nib file to the view property of the view controller. This method is called by the system, and is exposed in this class so you can override it to add behavior immediately before or after nib loading.
Do not call this method. If you require this method to be called, access the view property.

Do not invoke this method from other objects unless you take care to avoid redundant invocations. The default implementation of the loadView method handles redundant invocations correctly, but a view controller subclass might not. To be safe, other objects should instead access a view controller’s view property.

The loadView method first obtains the values of the view controller’s nibName and nibBundle properties. It then employs the NSNib class to instantiate the specified nib file via the instantiateWithOwner:topLevelObjects: method, providing the view controller object as the owner parameter.

For this method to work correctly, you need to have specified the file’s owner of the nib file, in Interface Builder, to be NSViewController. You also need to have correctly connected the view outlet of the file's owner to the intended view in the nib file. Then, at runtime, the nib loading machinery sets the value of the view controller’s view property to the nib file’s instantiated view.

Prior to OS X v10.10, the loadView method did not provide well-defined behavior if the nibName property’s value was nil. In macOS 10.10 and later, however, you get correct behavior without specifying a nib name as long as the nib file’s name is the same as that of the view controller. For example, if you have a view controller subclass called MyViewController and a nib file with the same name, you can employ the convenient initialization pattern [[MyViewController alloc] init].

Feedback, Comments & Corrections

NSViewControllerMBS.presentViewControllerAsModalWindow(ViewController as NSViewControllerMBS)
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method Cocoa MBS MacBase Plugin 18.4 Yes No No Yes, macOS only No
Function: Presents another view controller as a modal window, also known as an alert.
Notes: To dismiss the modal window, call the dismissViewController: method on self (the presenting view controller).

Feedback, Comments & Corrections

NSViewControllerMBS.presentViewControllerAsPopover(ViewController as NSViewControllerMBS, RelativeToRect as NSRectMBS, positioningView as NSViewMBS, preferredEdge as Integer, behavior as Integer)
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method Cocoa MBS MacBase Plugin 18.4 Yes No No Yes, macOS only No
Function: Presents another view controller as a popover.
Notes:
viewController: The other view controller to present as a popover.
RelativeToRect: The content size of the popover.
positioningView: The view relative to which the popover should be positioned. Must not be nil, or else the view controller raises an NSInvalidArgumentException exception.
preferredEdge: The edge of positioningView that the popover should prefer to be anchored to.
behavior: The popover’s closing behavior. See the NSPopoverBehavior enumeration.

To dismiss the popover, call the dismissViewController: method on self (the presenting view controller).

Feedback, Comments & Corrections

NSViewControllerMBS.presentViewControllerAsSheet(ViewController as NSViewControllerMBS)
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method Cocoa MBS MacBase Plugin 18.4 Yes No No Yes, macOS only No
Function: Presents a new sheet window with the given view controller.
Notes:
The presented view controller is the delegate and the content view controller of its sheet.
To dismiss the sheet, call the dismissViewController: method on self (the presenting view controller).

Feedback, Comments & Corrections

The items on this page are in the following plugins: MBS MacBase Plugin.




Links
MBS Xojo PDF Plugins