ios - how to parsing data in JSON to tableview -


i have json http://vmg.hdvietpro.com/ztv/home , how parsing data json in link table view. try code cant data json application.thanks help

movies.h

@interface movies : nsobject @property (strong,nonatomic) nsstring *moviesid; @property (strong,nonatomic) nsstring *text1; @property (strong,nonatomic) nsstring *thumbnail; #pragma mark - #pragma mark class methods -(id)initwithmoviesname:(nsstring *)ctext1 andthumbnail:(nsstring*) cthum  andmoviesid:(nsstring*) cid;  @end 

movies.m

@implementation movies @synthesize text1,moviesid,thumbnail; -(id)initwithmoviesname:(nsstring *)ctext1 andthumbnail:(nsstring*) cthum  andmoviesid:(nsstring    *) cid{     self=[super init];     if (self) {         text1=ctext1;         thumbnail=cthum;         moviesid=cid;     } return self; } @end 

tableviewcontroller

#define getdataurl @"http://vmg.hdvietpro.com/ztv/home"   -(void) retrievedata{         nsurl *url=[nsurl urlwithstring:getdataurl];         nsdata *data=[nsdata datawithcontentsofurl:url];         jsonarray=[nsjsonserialization jsonobjectwithdata:data                                                   options:kniloptions error:nil];         moviesarray=[[nsmutablearray alloc] init];         (int i=0; i<jsonarray.count; i++) {             nsstring *cid=[[jsonarray objectatindex:i] objectforkey:@"id"];             nsstring *cname=[[jsonarray objectatindex:i] objectforkey:@"text1"];             nsstring *cthum=[[jsonarray objectatindex:i] objectforkey:@"thumbnail"];             [moviesarray addobject:[[movies alloc]initwithmoviesname:cname andthumbnail:cthum andmoviesid:cid]];         }         [self.tableview reloaddata];     } 

try following:

nsarray * resparray = [[[[json objectforkey:@"response"]objectforkey:@"hot_program"]objectforkey:@"itempage"]objectforkey:@"page"]; 

Comments

Popular posts from this blog

javascript - RequestAnimationFrame not working when exiting fullscreen switching space on Safari -

Python ctypes access violation with const pointer arguments -