I am parsing information from my server and have all the information being downloaded but having a rough time trying to figure out how to add the information to a table view. Basically what I would like to know is how to take the information I do have and add it to a NSMutableArray then count that object and add it to a table view but everytime I add my strings to a mutable array I get nothing… but I know all the information is being parsed correctly by my logs and a lable I placed just for testing purposes… here is the code I am using to get the information. how can I take the string I used and populate my table view?
-(void)parser:(NSXMLParser*)parser didStartElement:(NSString *)elementName
namespaceURI:(NSString *)namespaceURI qualifiedName:(NSString *)qName
attributes:(NSDictionary *)attributeDict{
NSLog(@"Parser Was 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 some basic doubts (its ok, we all had those), that’s why I think you should learn by yourself to do that task (Information => Represent information on table). I would recommend you follow this tutorial:
http://www.icodeblog.com/2008/08/08/iphone-programming-tutorial-populating-uitableview-with-an-nsarray/
It teaches how to, from a NSMutableArray, represents information on a table. Try that and if you have any doubt, you can ask me and I help you out.