내 JSON 파일이인쇄 레이블 텍스트
[{"id":"1","category":"New Category1","title":"New Product2","description":"Please type a description1","imgurl":"http:\/\/s.wordpress.org\/about\/images\/wordpress-logo-notext-bg.png","spectitle":"Specification","specvalue":"Value"},{"id":"2","category":"Mobile","title":"Samsung","description":"Please type a description","imgurl":"http:\/\/s.wordpress.org\/about\/images\/wordpress-logo-notext-bg.png","spectitle":"Price","specvalue":"100$"}]
모양과 내가 성공적으로 전체를 분석 한 개별 labels.I의 ID, 카테고리, 제목, 설명을 인쇄 할 수있는 4 레이블이 json 개체를 하나의 레이블에 인쇄 할 수 있습니다. 해당하는 범주에 해당하는 모든 json 개체를 해당 레이블에 표시해야합니다. 나는 개인의 가치를하려고하면
NSString *labelstring =[NSString stringWithFormat:@"%@",[json objectAtIndex:0]];
label1.text=[NSString stringwithformat: objectForKey:@"id"];
label2.text=[NSString stringwithformat:objectForKey:@"category"];
label3.text=[NSString stringwithformat:objectForKey:@"title"];
label4.text=[NSString stringwithformat:objectForKey:@"description"];
여기에 JSON이 URL 정보와 그 일을 함께 NSArray를위한 변수입니다 ...하지만 난
가 어떻게'json' 변수를 할당 할을? json 파서를 사용합니까? 어느 것? – Adam
그 stringWithFormat : 호출은 불필요합니다 ... 당신은 몰랐습니까? –