Renaming Item Inside A View

Discussion in 'Mac Programming' started by Darkroom, Oct 11, 2008.

  1. Darkroom Guest

    Darkroom

    Joined:
    Dec 15, 2006
    Location:
    Montréal, Canada
    #1
    so i'm just trying to conceptualize how to do this in my head, since i couldn't really find anything in IB, or samples... a real demonstration is in iPhoto where events are allowed to be renamed... i read the documentation about Image Kit's Image Browser, assuming i would be able to rename images inside the image browser, but it only allows for the display of image names.

    so... does this make sense? :

    1) add mouse events to a label (don't think i can do that?)
    2) on double click, convert the label into a text box (cover label, make text box visible).
    3) on text entered, convert the label to text box's input, hide text box.
    4) register string to user defaults.

    thoughts?
     
  2. kainjow Moderator emeritus

    kainjow

    Joined:
    Jun 15, 2000
    #2
    Unless you have access to the views/cells that the image browser uses, it might be easier to open a sheet and allow the user to rename inside there.

    For saving the data, I wouldn't use user defaults. That's for preferences/settings, not data that is manipulated by the user. The preferred way to store that is in the ~/Library/Application Support/<App Name> directory (for example in a plist).
     
  3. Darkroom thread starter Guest

    Darkroom

    Joined:
    Dec 15, 2006
    Location:
    Montréal, Canada
    #3
    i though i'd use NSCollectionView for this instead of the image browser... i find it is more specific to my needs and less overkill since i wouldn't actually have to employ image kit, quartz framework to edit the images i drop into the browser... although, speaking of drop, i'm not sure how difficult it will be to enable NSCollectionView to accept drops, whereas dropping seems fairly straightforward with the image browser...

    anyway, so with NSCollectionView i do have access to the cell views... minus using user defaults and instead using the application support folder for the images added to the view, is my proposed method of renaming/changing strings generally the way to go? or is there an easier, more standard way of doing this?
     

Share This Page