Cocoa: Source View

Discussion in 'Mac Programming' started by MacDonaldsd, Sep 10, 2007.

  1. MacDonaldsd macrumors 65816

    MacDonaldsd

    Joined:
    Sep 8, 2005
    Location:
    London , UK
    #1
    How would you get content to "push" other content down. Such as in iTunes if you open playlist folder etc all the rest of the content bellow goes down a bit to accommodate it.
     
  2. Krevnik macrumors 68040

    Krevnik

    Joined:
    Sep 8, 2003
    #2
    I am not sure exactly what you mean... what behavior are you trying to replicate specifically? Your post is a bit vague, IMO.
     
  3. MacDonaldsd thread starter macrumors 65816

    MacDonaldsd

    Joined:
    Sep 8, 2005
    Location:
    London , UK
    #3
    Sorry im finding it hard to put into words. The most obvious example is:

    In iTunes you can choose what to display under library (movies, podcasts, etc)

    But how ever many you pick the store is always straight underneath. (if you only pick music there isn't a huge gap)
     
  4. Krevnik macrumors 68040

    Krevnik

    Joined:
    Sep 8, 2003
    #4
    Ahhhhhhh, now I know what you mean.

    The easiest way I find to do source lists in 10.4 is that you use an outline view or table view. Outline views are easier if you want collapsible groups, but it really boils down to needing a good data source object for the table. This data source should only tell the table/view exactly the objects it needs to know about, and make sure it gets updated whenever the number of objects in the view changes.

    The trick is keeping good track of your objects, and providing the right data to the view, never passing it empty/proxy objects to fill gaps. Only let the view know about objects you intend to tell it about, and if you need to insert something into the middle of an array, insertObject:atIndex: is your friend.
     
  5. MacDonaldsd thread starter macrumors 65816

    MacDonaldsd

    Joined:
    Sep 8, 2005
    Location:
    London , UK
    #6
    Kind of, some interesting code in there mind. Its a lot of code for something that appears so simple.
     

Share This Page