Looking for drop-down toolbar item example code

Discussion in 'Mac Programming' started by jpefjr, Jan 2, 2010.

  1. jpefjr macrumors regular

    jpefjr

    Joined:
    Jul 8, 2008
    #1
    Does anyone have an example code for a drop-down toolbar item like the "Overview" drop-down in Xcode? And does anyone know if a toolbar item like that can be created in Interface Builder?
     
  2. kainjow Moderator emeritus

    kainjow

    Joined:
    Jun 15, 2000
    #2
    Doesn't look like you can set a toolbar item's view in IB, but you could create a generic one, connect it to an outlet and then in your awakeFromNib, set its view, along with its min and max size.
     
  3. jpefjr thread starter macrumors regular

    jpefjr

    Joined:
    Jul 8, 2008
    #3
    Thanks for the answer kainjnow. It looks like I can connect the Received Actions from my view to the items in the drop-down menu and I can create the drop-down menu in Interface Builder by following this example:

    http://www.youtube.com/watch?v=Qr6EX-JIZZU

    The one problem is it does not change the selected value for the drop-down menu automatically but I'm hoping a can find a "selected" method to call for the drop-down menu toolbaritem.
     
  4. jpefjr thread starter macrumors regular

    jpefjr

    Joined:
    Jul 8, 2008
    #4
    OK, I found the answer to auto-select the appropriate item. Instead of changing the NSPopUpButton's type to "Pull down" I left it as "Pop up" and everything work as expected.
     

Share This Page