I am a novice Mac OS X developer. I assume this is an easy question, but I haven't been able to find any useful results via searches.
How do I constrain the size of a SECOND view controller?
I started with a simple Mac OS X app, with a single View Controller. I can select the window that contains the View Controller, then select the "Size Inspector" and check the "Minimum Content Size" box, and specify a minimum x and y for the window.
This allows me to specify the minimum size for this first view controller, as I expect. All is good.
Then I add a second view controller, with a Modal segue from the first view controller, triggered by a button press. I add a NSTextView to this second view controller, to display an attributed string. The text view works fine, displaying the attributed string correctly. This text view is a separate window, and has no minimum size constraint.
So how do i specify the minimum size for this second view controller view? Is this typically done in Interface Builder, or programmatically? When I step through the view hierarchy using Document Outline, I don't see how I can specify minimum size using the Size Inspector. Am I missing something??
Here is my simplified code:
file "ViewController.swift"
class ViewController: NSViewController {
...
override func prepare(for segue: NSStoryboardSegue, sender: Any?) {
let secondVC: SecondViewController = segue.destinationController as! SecondViewController
secondVC.reportAttrString = myReport.reportText
}
...
}
file "SecondViewController.swift"
class SecondViewController: NSViewController {
var reportAttrString = NSMutableAttributedString()
@IBOutlet var ReportTextView: NSTextView!
}
I would appreciate any suggestions, or pointers to any documentation or tutorials that may help me.