NSTabViewController toolbar delegate on 10.11

Hi everyone,


I currently have an application working on Yosemite which uses a storyboard and contains an NSTabViewController subclass that uses the new toolbar style for displaying its tab view items. As suggested in the headers, my subclass implements some of the NSToolbarDelegate methods to add additional items (a search field and some buttons) to the toolbar.


This works perfectly on 10.10. However, when I run my app on 10.11, it seems like my NSTabViewController subclass is not set as the delegate of the corresponding NSToolbar instance (the value of that property seems to be an instance of a private class named NSTabViewControllerToolbarUIProvider), so my delegate methods don't get called and my custom elements are not added into the toolbar.


Has someone experienced the same issue? Is there any available workaround for this?

Thanks in advance!

Replies

Can you file a radar for this (if you already haven't)?

This is an issue that will have to be fixed with NSTabViewController.

Sure! Radar id is rdar://22348095

Thank you

There's no news on this issue and it seems to be broken also on 10.11.1 and 10.11.2 beta, so I started to look for temporary workarounds an I'm sharing the best one with you, hoping it can be useful for anyone else.

  • First, I tried to set the delegate property manually, which does not work because it's set back to the NSTabViewControllerToolbarUIProvider object afterwards.
  • You can also try to insert the items into the toolbar manually, but this breaks tab view controller's selection feature (the selected item does not change when the user selects a tab)
  • Finally, I created this workaround: (https://gservera.com/cdn/TabViewControllerBug.zip). It plays with the Objective-C runtime, so it is quite fragile (a change in Apple's implementation could break it at any time) and not an elegant solution at all, but it works and it's something we have until Apple fixes this and many other IB bugs that don't seem to be their priority, since they not even appear in the 'known issues' section of the release notes. The attached Xcode project includes two targets (one to demonstrate that the bug actually exists, and the other one with the temporary workaround).

Hopefully, this will get fixed soon.

I'm having the same issue. The delegate methods are never called.


Would really like this to be fixed. I think it's great for iOS developers that are learning to develop on mac to be able to use the NSTabViewController with the tabs in the toolbar. It's easy to understand. So please fix. Thanks.

This should be fixed with the 10.11.2 betas.

I just confirmed with the original and new test apps against the beta 3 release.