nesting Array

Discussion in 'Mac Programming' started by saleh.hi.62, Oct 26, 2011.

  1. saleh.hi.62 macrumors member

    Joined:
    Jul 25, 2011
    #1
    guys, here is the scenario. i have a list of Strings (like an array). but each node of this list should refer to an string array.

    As you can see in the below figure you can see, each website has a list which contain all the web pages' links.

    what is the best way to implement it in Objective-C ?
     

    Attached Files:

  2. robbieduncan Moderator emeritus

    robbieduncan

    Joined:
    Jul 24, 2002
    Location:
    London
    #2
    An NSArray can, quite happily, contain NSArrays as elements.
     
  3. saleh.hi.62 thread starter macrumors member

    Joined:
    Jul 25, 2011
    #3
    but take note that the Queue of websites needs to contains URL plus a conetion to the list of URLs
     
  4. robbieduncan Moderator emeritus

    robbieduncan

    Joined:
    Jul 24, 2002
    Location:
    London
    #4
    Then either create a custom object that represents each item in the queue or use a NSDictionary for each item in the queue with known keys for each attribute you need to store.
     
  5. saleh.hi.62 thread starter macrumors member

    Joined:
    Jul 25, 2011
    #5
    thank you for your guidance, i am very beginner in objective c!

    if it's possible, may you present me an example code here? i will bed so thankful :)
     
  6. robbieduncan Moderator emeritus

    robbieduncan

    Joined:
    Jul 24, 2002
    Location:
    London
    #6
    No. I don't do sample code. In general it is simply copied without any effort being made to understand it which does not help anyone learn.
     
  7. gnasher729, Oct 26, 2011
    Last edited by a moderator: Oct 26, 2011

    gnasher729 macrumors P6

    gnasher729

    Joined:
    Nov 25, 2005
    #7
    Start XCode 4, Command-Shift-2, and look around. You'll find plenty of examples. If you can't find any sample code there, find a different job.
     
  8. saleh.hi.62 thread starter macrumors member

    Joined:
    Jul 25, 2011
    #8
    ok i will try to say what i have thought, i will make a Arrray with NSDictionary. in each item:

    KEY= Website name
    and
    VALUE= another array which store the name of webpages.

    how can i store the address of new array(webpage's array) into the VALUE field?
     
  9. lee1210 macrumors 68040

    lee1210

    Joined:
    Jan 10, 2005
    Location:
    Dallas, TX
    #9
    You store a new NSArray as the value. You can use whatever sort of object you'd like for the value.

    -Lee
     

Share This Page