JSON Parsing and put in TableView+Hierarchy

Discussion in 'iOS Programming' started by mehdies, Nov 10, 2013.

  1. mehdies macrumors member

    Joined:
    Jun 10, 2012
    #1
    Hi Friends,

    I have 3 ViewController : 1 - ViewController.h/.m/.xib
    2 - FirstViewController.h/.m/.xib
    3 - ShowContentViewController.h/.m/.xib

    My first and second ViewController's have TableView(each one has a TableView) for showing Name element of first JSON file (category.json) and ShowContentViewController have a UIImageView to show an image.

    First JSON file have like this :

    Code:
    [{"parentid":0,"id":1,"name":"Norway"},
    {"parentid":0,"id":2,"name":"Italy"},
    {"parentid":0,"id":3,"name":"Finland"},
    {"parentid":0,"id":4,"name":"Japan"},
    {"parentid":1,"id":100,"name":"Oslo"},
    {"parentid":2,"id":101,"name":"Milan"},
    {"parentid":3,"id":102,"name":"Helsinki"},
    {"parentid":4,"id":103,"name":"Tokyo"}]
    and second JSON file have like this :

    Code:
    [{"pid":103,"image":"tokyo.jpg"},
    {"pid":102,"image":"helsinki.jpg"},
    {"pid":101,"image":"milan.jpg"},
    {"pid":100,"image":"oslo.jpg"}]
    i want to program work like following :

    1 - when program starts : first ViewController show name's with parented = 0 in cells
    2 - when user select any on Name's,program show second ViewController with correspond item in JSON.for example if user Select Norway(id=1) program show Oslo(parentid=1).
    3 - if user select any of items in second ViewController program show correspond image from second JSON file.for example if user first select Norway and the select Oslo(id=100) we must see oslo.jpg(pid=100)


    * these are sample JSON file and maybe when user select any parentid=0 item program show more items than one.
    * i can show item's with parentid=0 but after that i can't continue!


    Could you explain me roadmap??


    Thanks
     
  2. Tander macrumors 6502a

    Tander

    Joined:
    Oct 21, 2011
    Location:
    Johannesburg, South Africa
    #2
    What have you tried to do so far?
    Do you have any code yet or have you not even attempted this yet?
     
  3. IDMah macrumors 6502

    IDMah

    Joined:
    May 13, 2011
    #3
    I used this Tutorial as a framework. And .. JSON Parse Tutorial

    I find Ray's stuff awesome also has a few UITableView tutorials.

    Both were extremely useful to a 'nube' like me.
    Good Luck good code.
    Ian
     

Share This Page