Disable zoom and minimize in modal ViewController - cocoa

I'm building a Cocoa app using XCode Storyboard and created a modal viewcontroller connected to an IBAction button click.
Storyboard
Clicking the button successfully creates a new window.
However, I want to disable:
- Close
- Zoom
- Minimize
The funky thing is because it's a modal viewcontroller, I can't disable them like I can in a Windowcontroller.
I do have a ViewController.m file, where I'm able to set the Window title and restrict resizing using self.preferredContentSize. But not sure how to disable the close, zoom, and minimize...
Thanks!

In the modal view controller
override func viewWillAppear() {
super.viewWillAppear()
self.view.window?.styleMask = NSTitledWindowMask
}

Related

How to display window overtop toolbar in a Mac Catalyst app similar to modal presentations?

In an iOS app, you can display a window overtop everything (navigation bar, tab bar, etc) by simply adding a subview to your key UIWindow. You can build a custom alert or loading view with a dim overlay using this approach.
If you try this in a Mac Catalyst app, it will cover up your main interface and the sidebar, but it will not cover up the toolbar. I've also tried creating a new UIWindow but it too doesn't overlay the toolbar.
if let windowScene = UIApplication.shared.connectedScenes.first as? UIWindowScene {
let newWindow = UIWindow(windowScene: windowScene)
newWindow?.windowLevel = .alert + 100
newWindow?.backgroundColor = .black.withAlphaComponent(0.5)
newWindow?.makeKeyAndVisible()
}
How can you create a UIWindow to appear overtop your NSToolbar in a Mac Catalyst app, similar to how modal form sheet presentations cover up the entire window?

Load WebView URL inside Notification Bar NSPopover

I'm a noob OSX Developer having issues getting a WebView to load a URL when inside of a Custom View using NSPopover...My NSPopover is activated when a notification bar item is clicked.
This code is in my application delegate under
"- (void)applicationDidFinishLaunching:(NSNotification *)aNotification":
NSURL*url=[NSURL URLWithString:#"http://www.google.com"];
NSURLRequest*request=[NSURLRequest requestWithURL:url];
[[_webView mainFrame] loadRequest:request];
It works just fine if I move the WebView to any other window, but the WebView in my Custom View for this NSPopover displays as a blank page. Any ideas why? Any additional information you might need? Limitation of the CustomView?
You have created the Outlet in IB for the UIWebView in your Custom View ? and strung it together?

Xcode: dragging from ViewController Icon

In Xcode,
what does it mean to drag from the orange ViewController icon to lets say a Label.
how is this different from dragging a line from the Label to the interface to setup an outlet?
If you don't use the assistent editor (interface builder and header file) then one way dragging is making an outlet, and the other way is to make an action (for example to make a UIButton IBAction method).
When you use the assistent editor you can just drag from the UI object to the header file and choose to make an outlet or an action:

WebView blank after reopening NSWindow

I am using a WebView to display some incoming content to users in a single-window application.
There is a single window controller in the app delegate that I use to send -showWindow: on -applicationDidFinishLaunching: and -applicationShouldHandleReopen:hasVisibleWindows: notifications.
This works well until I close the window and click the dock icon to reopen the window.
At this point the web view is blank and no longer responds to mouse input, such as the scroll wheel. The scroll view still indicates the apparent size of the document.
The window is not released on close, according to IB.
Am I missing something with regards to keeping that content around?
According to the documentation WebView is closed with window. However, we can subclass WebView and override shouldCloseWithWindow and return NO.
- (BOOL)shouldCloseWithWindow

Xcode 4 / Interface Builder "master" view UITabBarController template

I started an iPhone App with the Xcode template for UITabBarController, which created a couple of default UIViews (MainWindow, FirstView and SecondView).
The MainWindow xib shows the tabbar itself, which can be configured there.
FirstView and SecondView have an unselectable UITabBar anchored to the bottom, which is ostensibly to show the relationship to MainWindow.
Note that I've created many new views that are part of the main UITabBar and they work fine, but they don't show that UITabBar at the bottom in Interface Builder.
My question is, how does that work, and how can I create a new view such that it will show that unselectable UITabBar at the bottom?
What you're seeing is simply Interface Builder's "simulated metrics" and it shouldn't actually have any bearing on the app's behavior. But this is how you can change it:

Resources