5 Replies
      Latest reply on Nov 16, 2015 6:21 PM by taylork
      gservera Level 1 Level 1 (0 points)

        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!

        • Re: NSTabViewController toolbar delegate on 10.11
          taylork Apple Staff Apple Staff (10 points)

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

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

          • Re: NSTabViewController toolbar delegate on 10.11
            gservera Level 1 Level 1 (0 points)

            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.

            • Re: NSTabViewController toolbar delegate on 10.11
              Kev Level 1 Level 1 (0 points)

              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.