如何将数组元素放在表视图单元格上

Tbt*_*ano 0 arrays objective-c uitableview ios

我一直在尝试将我的数组的值放在我的表视图单元格中,它是多维数组我应该怎么做?

这是一个解析器类

-(void)parser:(NSXMLParser *)parser didEndElement:(NSString *)elementName namespaceURI:(NSString *)namespaceURI qualifiedName:(NSString *)qName
{
if ([elementName isEqualToString:@"subsidiary"])
{
      NSLog(@"%i", [app.infoarray count]);
    [app.listArray addObject:app.infoarray];
    [app.infoarray removeAllObjects];

}
else
{
     if ([elementName isEqualToString:@"countryname"])
     {
         temp = currentElementValue;

     }
    if ([elementName isEqualToString:@"name"])
    {

        theList.name = currentElementValue;
        [app.infoarray addObject:theList.name];
    }
    if ([elementName isEqualToString:@"address"])
    {
        theList.address = currentElementValue;
        [app.infoarray addObject:theList.address];
    }
Run Code Online (Sandbox Code Playgroud)

下面的代码是mainviewcontroller

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
static NSString *CellIdentifier = @"Cell";

UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil) {
    cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier];
    cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator;
}

theList.countryname = [app.listArray objectAtIndex:0];
cell.textLabel.text= theList.countryname; ////<<WHAT SHOULD I DO HERE?
cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator;
return cell;

}
Run Code Online (Sandbox Code Playgroud)

我只是希望cell.textlabel显示国家名称我只是在Objective-c中新的我希望有人可以帮助我

Jac*_*ack 5

我认为你应该在应用数据之前深入了解UITableView.

这是一个非常基本的例子:https://github.com/makadaw/UITableView-Sample

并调查Apple的一些示例:https://developer.apple.com/library/ios/#samplecode/TableViewSuite/Introduction/Intro.html#//apple_ref/doc/uid/DTS40007318