Objective c 如何向UITableView显示空值?如果在iphone sdk的webservice响应中未找到标记

Objective c 如何向UITableView显示空值?如果在iphone sdk的webservice响应中未找到标记,objective-c,ios,cocoa-touch,uitableview,nsxmlparser,Objective C,Ios,Cocoa Touch,Uitableview,Nsxmlparser,在uitableviewcell中添加空值,如下所示: - (void)parser:(NSXMLParser *)parser didStartElement:(NSString *)elementName namespaceURI:(NSString *)namespaceURI qualifiedName:(NSString *)qualifiedName attributes:(NSDictionary *)attributeDict { if( [elementName isE

在uitableviewcell中添加空值,如下所示:

- (void)parser:(NSXMLParser *)parser didStartElement:(NSString *)elementName namespaceURI:(NSString *)namespaceURI qualifiedName:(NSString *)qualifiedName attributes:(NSDictionary *)attributeDict
{
    if( [elementName isEqualToString:@"PublicBusinessName"])
    {
    boolListofareasdata=YES;
    }
    else if( [elementName isEqualToString:@"ProfessionName"])
    {
        boolListofareasdata1=YES;
    }
    else if( [elementName isEqualToString:@"PublicContactEmail"])
    {
        boolListofareasdata2=YES;
    }
    else if( [elementName isEqualToString:@"PublicBusinessURL"])
    {
        boolListofareasdata3=YES;
    }
    else if( [elementName isEqualToString:@"BrandLogoName"])
    {
        boolListofareasdata4=YES;
    }
}


- (void)parser:(NSXMLParser *)parser foundCharacters:(NSString *)string
{
    if (boolListofareasdata)
    {
        [arrareasdata addObject:string];

        NSLog(@"NAME...............%@",arrareasdata);
    }
    else if (boolListofareasdata1)
    {
        [arrareasdata1 addObject:string];

        NSLog(@"DESIGN..............%@",arrareasdata1);
    }
    else if (boolListofareasdata2)
    {
        [arrareasdata2 addObject:string];

        NSLog(@"DESIGN..............%@",arrareasdata1);
    }
    else if (boolListofareasdata3)
    {
        [arrareasdata3 addObject:string];

        NSLog(@"WEB....................%@",arrareasdata3);
    }
    else if (boolListofareasdata4)
    {
        [arrareasdata4 addObject:str];

        NSLog(@"WEB....................%@",arrareasdata4);
    }
}

-(void)parser:(NSXMLParser *)parser didEndElement:(NSString *)elementName namespaceURI:   (NSString *)namespaceURI qualifiedName:(NSString *)qName
{
    if ([elementName isEqualToString:@"PublicBusinessName"])
    {
        boolListofareasdata=NO; 
    }
    else if ([elementName isEqualToString:@"ProfessionName"])
    {
        boolListofareasdata1=NO; 
    }
    else if( [elementName isEqualToString:@"PublicContactEmail"])
    {
        boolListofareasdata2=NO;
    }
    else if ([elementName isEqualToString:@"PublicBusinessURL"])
    {
        boolListofareasdata3=NO; 
    }
    else if ([elementName isEqualToString:@"BrandLogoName"])
    {
        boolListofareasdata4=NO; 
    }
}

- (void)parserDidEndDocument:(NSXMLParser *)parser{
    [tableView reloadData];
}

- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
{   
    return 1;
}

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
    return [arrareasdata3 count];
}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath  *)indexPath
{

    static NSString *CellIdentifier = @"CustomCell";

    CustomCell *cell = (CustomCell *) [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
    if (cell == nil) {        
        NSArray *topLevelObjects = [[NSBundle mainBundle] loadNibNamed:@"CustomCell" owner:self options:nil];

        for (id currentObject in topLevelObjects)
        {
            if ([currentObject isKindOfClass:[UITableViewCell class]])
            {
                cell =  (CustomCell *) currentObject;
                break;
            }
        }
    }

    NSLog(@"TABLE VIEW CONTROLLER........................");
    cell.nameLabel.text = [arrareasdata objectAtIndex:indexPath.row];
    cell.designLabel.text = [arrareasdata1 objectAtIndex:indexPath.row];
    cell.emailLabel.text = [arrareasdata2 objectAtIndex:indexPath.row];
    cell.webLabel.text = [arrareasdata3 objectAtIndex:indexPath.row];

    return cell;
}

你的问题不清楚,而且你的代码转储也帮不了什么忙。缺少什么元素?返回什么数据?你的自定义单元格做什么?您的NSLog的输出是什么。缩小你的问题和代码范围,也许有人能帮上忙——实际上我正在获取一些值并显示到tableview中。在本例中,来自asmx响应的一些空标记。因此,如果([arrareasdata objectAtIndex:Indexath.row].length>0){cell.nameLabel.text=[arrareasdata objectAtIndex:Indexath.row]}或者{cell.nameLabel.text=@”“;}在获取值的案例组(如名称、年龄、地址)中,我无法在类型为“id”的对象上找到空标记…属性“length”;}在webservices中,如果年龄标记不是来自有时剩余的两个标记…如何检查这一点?…如果([yourAgeArray count]>0){//年龄值为}否则{//无年龄值},则年龄标记数组将进行计数0检查我的身份证是纳瓦迪亚_paresh@rediffmail.com代码有什么问题请给我发navadiya_paresh@yahoo.com因为无法在我的公司中打开rediff
 NSString *strName = [arrareasdata objectAtIndex:indexPath.row];
 if((strName.length > 0)  
 {
   cell.nameLabel.text = strName;
 }
 else
 {
    cell.nameLabel.text = @"";
 }
 //same logic for designLabel,emailLabel,webLabel in which u will fill your data