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

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?

Related

UIApplicationShortcutIconType.Contact shows the refresh icon on xamarin.iOS in navigation bar

I'm developing an iOS app with Xamarin.iOS.
I'm trying to put a contact icon in my Navigationitem. According to the Apple developer docs(https://developer.apple.com/ios/human-interface-guidelines/icons-and-images/system-icons/) you have to use UIApplicationShortcutIconType.Contact.
When i'm using this I get the reply icon in my navigation bar.
Reply icon in navigation bar
And it should be this:
Contact icon
Here's my code:
NavigationItem.Title = "Menu";
NavigationItem.HidesBackButton = true;
var contactbutton = (UIBarButtonSystemItem)UIApplicationShortcutIconType.Contact;
NavigationItem.RightBarButtonItem = new UIBarButtonItem(contactbutton);
NavigationController.NavigationBarHidden = false;
Does anyone have an idea what's the problem in this case.
As you read from the documentation the UIApplicationShortcutIconType is Home Screen Quick Action Icons used for 3D touch shortcuts. We can not use it for Navigation Bar and Toolbar Icons as UIBarButtonSystemItem.
If you do want to use system style. You can only try UIBarButtonSystemItem here.
Also you can see the thread below. It posts some references we can't do this:
https://stackoverflow.com/a/43063432/8354952

TouchBar don't displayed NSViewController Storyboard

I use Xcode 8.2.1 on macOS 10.12.3
I try to display element on TouchBar with my NSViewController but I can't do it... I have just drag&drop the TouchBar element on my NSViewController element in my Storyboard and add a label but this label is not displayed.
You have to drag the TouchBar in the Window Controller, not the View Controller. Also make sure that your Window is initial controller.
PS
An information in some ways related with this question: when, in the view, there is a text field in focus, the standard touch bar will overwrite your customized touch bar. More information here.

OSX Multiple toolbars in NSTabViewController

I have a structure which is represented in the picture below (sorry but apparently in OS Sierra Xcode does not support anymore zooming in the storyboard -.- )
Window > TabController > View Controllers
Basically what I wanted to do is to have multiple toolbars, each one for a different ViewControllers. If I were on iOS I could have set a UINavigationController as target of the TabViewController and then do whatever I wanted with the related navigation bar, but here in OSX I cannot link the TabViewController to a WindowController (which handles the toolbar), hence having a window controller per view controller.
Is there any simple workaround for that?
Or the only solution is to empty-refill the toolbar with the correct buttons every time a Tab is selected?

Disable zoom and minimize in modal ViewController

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
}

Xcode 5 — wrong interface on a device with iOS7

My setting for the project:
Deployment target: iOS6.1
Base SDK: 7.0
IB Document: Opens in 5.0
When I run app in simulator(7.0) I see almost what I expect (I don't understand why barbuttons don't use color tint — on previous screen it shows blue):
But if app is running on a device (also 7.0),
Then I see:
As you can see this is some kind of iOS6 UI, but tableview goes under the navbar, which became transparent.
Why does it happen?
Behavior of tintColor for bars has changed on iOS 7.0, please check the image below:
So now to change the tint color for your bar buttons you need to use tintColor which is the color for the interactive elements within a navigation bar including button images and titles.
While barTintColor is the background color of the UINavigationBar.
So basically
For buttons and title:
[[UINavigationBar appearance] setTintColor:[UIColor grayColor]];
For bar tint:
[[UINavigationBar appearance] setBarTintColor:[UIColor lightGrayColor]];
For the tableVIew under the navBar part, set navigationBar.translucent = NO;
I enabled Autolayout in IB, and now it uses iOS7 on a device too.
Upd.: After some time it start show strange design again. It gone only after I set iOS7 as base and deployment SDK.

Resources