Adding a custom view to toolbar

后端 未结 2 768
你的背包
你的背包 2021-02-07 15:10

I\'m struggling with Cocoa for 2 hours now without success. I want to add a custom view to the toolbar. So, I added a NSToolbar to the window (with IB), and added my view (which

2条回答
  •  情深已故
    2021-02-07 15:39

    I solved the problem.

    I put my custom view in the root of the nib. I added a classic NSToolbarItem and created two outlets: one for the custom view and one for the NSToolbarItem. On -(void)awakeFromNib, I called setView: on the NSToolbarItem with the custom view.

    According to some ressources on the internet, it is a bug with Interface Builder.

提交回复
热议问题