ios - Populating UITableView with XML data -
i parsing information server , have information being downloaded having rough time trying figure out how add information table view. know how take information have , add nsmutablearray count object , add table view everytime add strings mutable array nothing... know information being parsed correctly logs , lable placed testing purposes... here code using information. how can take string used , populate table view?
-(void)parser:(nsxmlparser*)parser didstartelement:(nsstring *)elementname namespaceuri:(nsstring *)namespaceuri qualifiedname:(nsstring *)qname attributes:(nsdictionary *)attributedict{ nslog(@"parser called"); if ([elementname isequaltostring:@"element"]) { nslog(@"elements recieved %@", [attributedict objectforkey:@"themename"]); themenamestring = [nsstring stringwithformat:@"%@", [attributedict objectforkey:@"themename"]]; //test first string label.text = themenamestring; } if ([elementname isequaltostring:@"element1"]) { nslog(@"elements recieved %@", [attributedict objectforkey:@"creator"]); themecreator = [nsstring stringwithformat:@"%@", [attributedict objectforkey:@"creator"]]; } if ([elementname isequaltostring:@"element2"]) { nslog(@"elements recieved %@", [attributedict objectforkey:@"price"]); themeprice = [nsstring stringwithformat:@"%@", [attributedict objectforkey:@"price"]]; } if ([elementname isequaltostring:@"element3"]) { nslog(@"elements recieved %@", [attributedict objectforkey:@"twittername"]); creatortwittername = [nsstring stringwithformat:@"%@", [attributedict objectforkey:@"twittername"]]; } if ([elementname isequaltostring:@"element4"]) { nslog(@"elements recieved %@", [attributedict objectforkey:@"themeurl"]); cydialink = [nsstring stringwithformat:@"%@", [attributedict objectforkey:@"themeurl"]]; } if ([elementname isequaltostring:@"element5"]) { nslog(@"elements recieved %@", [attributedict objectforkey:@"themedeciption"]); deciption = [nsstring stringwithformat:@"%@", [attributedict objectforkey:@"themedeciption"]]; } if ([elementname isequaltostring:@"element6"]) { nslog(@"elements recieved %@", [attributedict objectforkey:@"themescreenshots"]); screenshots = [nsstring stringwithformat:@"%@", [attributedict objectforkey:@"themescreenshots"]]; } if ([elementname isequaltostring:@"element7"]) { nslog(@"elements recieved %@", [attributedict objectforkey:@"promo"]); tblviewimage = [nsstring stringwithformat:@"%@", [attributedict objectforkey:@"promo"]]; } }
you have basic doubts (its ok, had those), that's why think should learn task (information => represent information on table). recommend follow tutorial:
it teaches how to, nsmutablearray, represents information on table. try , if have doubt, can ask me , out.
Comments
Post a Comment