toolbar:itemForItemIdentifier:willBeInsertedIntoToolbar: and nibs

  • The documentation for toolbar:itemForItemIdentifier:willBeInsertedIntoToolbar: says that it's optional for nib toolbars, but it can still be used to "augment functionality". My experience is that it actually doesn't get called at all in the nib case, which isn't good because I want to know if my items are going into the toolbar or the customize palette. All my delegate is getting is toolbarWillAddItem:, which isn't enough.

    Are the docs wrong, or am I doing it wrong?
  • On Jun 12, 2013, at 3:53 PM, David Catmull wrote:

    > The documentation for toolbar:itemForItemIdentifier:willBeInsertedIntoToolbar: says that it's optional for nib toolbars, but it can still be used to "augment functionality". My experience is that it actually doesn't get called at all in the nib case, which isn't good because I want to know if my items are going into the toolbar or the customize palette. All my delegate is getting is toolbarWillAddItem:, which isn't enough.
    >
    > Are the docs wrong, or am I doing it wrong?

    The docs do not say how Interface Builder-created toolbars differ from programmatically created ones, but it is logical that the nib-instantiated toolbar does not make a number of the toolbar-creation delegate calls even if a delegate is set as the information it would request is already "known".

    Also, I suspect that the docs you cite might be saying that you would subclass NSToolbar and implement that delegate method if you want to intercept it.

    HTH,

    Keary Suska
    Esoteritech, Inc.
    "Demystifying technology for your home or business"
  • On Jun 12, 2013, at 5:14 PM, Keary Suska <cocoa-dev...> wrote:
    > Also, I suspect that the docs you cite might be saying that you would subclass NSToolbar and implement that delegate method if you want to intercept it.

    If I implement that method in a subclass, then it gets called with toolbar and itemIdentifier set to nil, and the flag is YES even though it's setting up the customize sheet. So it's interesting that it gets called at all, but it's still strangely useless.
previous month june 2013 next month
MTWTFSS
          1 2
3 4 5 6 7 8 9
10 11 12 13 14 15 16
17 18 19 20 21 22 23
24 25 26 27 28 29 30
Go to today