How Can I Make Parsed XML Data Appear On Custom TableViewCell?

Discussion in 'iOS Programming' started by loon3y, May 10, 2012.

  1. loon3y macrumors 65816

    loon3y

    Joined:
    Oct 21, 2011
    #1
    I'm making a split view iPad product search.



    in the debugger, it shows I'm getting the parsed data, it just won't show up on my table view, so i decided to make a custom TableViewCell creating the .h and .m files.


    but i have a problem, i have my XML parser in my MasterViewController, but i want to assign it to a label in my Custom TableViewCell object.


    Code:
    - (void)parser:(NSXMLParser *)parser didEndElement:(NSString *)elementName 
      namespaceURI:(NSString *)namespaceURI qualifiedName:(NSString *)qName
    {
        NSLog (@"didEndElement");
        
        if ([elementName isEqualToString:@"description"])
        {
            NSLog(@" decription:%@", capturedCharacters);
            
          
    
    
           StyleMasterCell.textView.text =  capturedCharacters;
         
    
    
    }
        
        capturedCharacters = nil;   
        
        if ([elementName isEqualToString:@"str_smartsearch"]) 
        {
            // We are no longer in an item element
           inItemElement = NO;
        }
    }
    


    i only included description so it will be simple, and I wanna just at least get one thing working first and foremost.




    this line: StyleMasterCell.textView.text = capturedCharacters;


    does not work, how can i assign the parsed at a to the textView thats in the stylemastercell?
     
  2. MattInOz macrumors 68030

    MattInOz

    Joined:
    Jan 19, 2006
    Location:
    Sydney
    #2
    You should be able to get the the tableview to display your data in a basic form before needing to make a custom cell. Custom cells are about tweaking the display.

    For a tableview your model is generally a collection of objects like an array.
    If you change the data you do so by changing the array then let the tableview know it needs to update. There is a controller class that sits between the manages the feed of data between the model and the table.

    You generally can't send a message to a cell.
    You need to wait for the tableview to ask you for what info is displayed in a cell.

    Might be worth taking a step back.
    work through a tutorial that implements a tableview,like this one :-
    how-to-create-a-simple-iphone-app-tutorial-part-1

    From there work out how to adapt the Data model to suit your app.
     

Share This Page