Issue with addTitlebarAccessoryViewController on 10.10
Issue with addTitlebarAccessoryViewController on 10.10
- Subject: Issue with addTitlebarAccessoryViewController on 10.10
- From: Mark Allan <email@hidden>
- Date: Fri, 03 Mar 2017 14:39:15 +0000
Hi all,
I've got an NSWindow which has an NSToolbar added programmatically. The window does not use a shared title/toolbar. I now want to add a little bit of text/button to the window's titlebar, so for OS X 10.6 to 10.9, I'm doing it the old way playing around with NSWindow subviews, which works fine.
On versions 10.10+ I'm using addTitlebarAccessoryViewController which works great on 10.11 and 10.12, but for some reason it shifts the toolbar buttons out of position on 10.10.
Judging by the AppKit release notes, this is a known issue which was fixed in 10.11, and also by linking on 10.11
> For applications linked on 10.11 and higher, a NSTitlebarAccessoryViewController with the layoutAttribute set to NSLayoutAttributeRight will no longer right indent toolbar items, unless the titleVisibility == NSWindowTitleHidden. This allows placing a view/button/textfield (etc) above the toolbar without right indenting the toolbar. However, for the NSWindowTitleHidden, there is still a desire to indent the toolbar on the right to leave space for the accessory view.
I'm currently building on macOS 10.12 (with target of 10.6) but the issue still shows up for users on OS X 10.11, even with the viewcontroller's layoutAttribute = NSLayoutAttributeRight.
Does anyone know of a fix or workaround I could use please?
If it comes to it, I could still use the old subview manipulation method on 10.10 and users would just have to put up with seeing junk in the log about adding an unknown subview, but I'd rather avoid that if possible!
Would appreciate any help.
Many thanks
Mark
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden