Ios 我在tableview上显示的代码中的错误在哪里?

Ios 我在tableview上显示的代码中的错误在哪里?,ios,objective-c,uitableview,Ios,Objective C,Uitableview,我尝试从web服务加载一个数组并在表视图上显示。这是我的表视图。但有一个错误。Branchnames是 迈赫迈特·福代尔·奥兹坎 SELAHATTİN KOÇAK 迈赫迈特苏纳埃肯汽油公司 哈桑卡特克汽油公司 等 等 但是表视图显示我是这样的 我怎么解决这个问题 Th 数组代码: -(void)parser:(NSXMLParser *)parser didStartElement:(NSString *)elementName namespaceURI:(NSString *)namespa

我尝试从web服务加载一个数组并在表视图上显示。这是我的表视图。但有一个错误。Branchnames是

迈赫迈特·福代尔·奥兹坎

SELAHATTİN KOÇAK

迈赫迈特苏纳埃肯汽油公司

哈桑卡特克汽油公司

但是表视图显示我是这样的

我怎么解决这个问题

Th 数组代码:

-(void)parser:(NSXMLParser *)parser didStartElement:(NSString *)elementName namespaceURI:(NSString *)namespaceURI qualifiedName:(NSString *)qName attributes: (NSDictionary *)attributeDict
{
  if ( [elementName isEqualToString:@"Branchname"] )
  {
    teveRetorno = YES;
  }
  else if ( [elementName isEqualToString:@"GetBranchNameResult"] )
  {
    myArray = [[NSMutableArray alloc] init];
  }
}

- (void)parser:(NSXMLParser *)parser foundCharacters:(NSString *)string{
  if (teveRetorno) {
    //[retornoSOAP appendString:string];
    [myArray addObject:string];
  }
}

- (void)parser:(NSXMLParser *)parser didEndElement:(NSString *)elementName namespaceURI:(NSString *)namespaceURI qualifiedName:(NSString *)qName{
  if ( [elementName isEqualToString:@"Branchname"] ) {
    NSLog(@"My Array %@",myArray);

    [[self tableView]reloadData];

    //retornoSOAP = nil;
    teveRetorno = NO;
  }
}
表代码

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
  #warning Incomplete method implementation.
  // Return the number of rows in the section.

  return [self.myArray count];
}

- (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.textLabel.text =[myArray objectAtIndex:indexPath.row];
  return cell;
}

如果您询问文本被截断的原因,请为单元格的文本标签设置adjustsFontSizeToFitWidth。如果无法修复,请手动降低文本标签的字体。

您的表视图或输出没有问题。您的XMLParser被某些字符(Ö)弄糊涂了,调用didStartElement太早了。查看此-

您是否想知道文本被截断的原因?请尝试设置
cell.textlab.adjustsFontSizeToFitWidth=YES
@jeffamaphone是的。我希望显示在一行中。我添加了您的代码,结果就在这里,所以您的问题解决了吗?@jeffamaphone否。我认为XML解析器无法解析非法字符(Ö、İ、Ü、Ş、ı)也许您需要在源代码处转义这些字符?