0

我正在使用 xmpp 开发聊天应用程序。我在表格中获得了 gmail 和 Facebook 联系人。但我的表包含 3 个部分

-(NSString*)tableView:(UITableView *)tableView titleForHeaderInSection:(NSInteger)sectionIndex
{
    NSArray *sections = [[self fetchedResultsController] sections];

    if (sectionIndex < [sections count])
    {
        id <NSFetchedResultsSectionInfo> sectionInfo = [sections objectAtIndex:sectionIndex];

        int section = [sectionInfo.name intValue];
        switch (section)
        {
            case 0  : return @"Available";
            case 1  : return @"Away";
            default : return @"Offline";
        }
    }

    return @"";
}

我的问题是如何区分 gmail 和 Facebook 联系人

4

1 回答 1

0
UILabel *lblText = [[UILabel alloc] initWithFrame:CGRectMake(290,16,10,20)]; 
    lblText.textColor = [UIColor orangeColor];
    [cell addSubview:lblText]; 

    if ([[user jidStr] rangeOfString:@"gmail"].location == NSNotFound) 
    {
        if([[user jidStr] rangeOfString:@"facebook"].location==NSNotFound)
        {
            lblText.text=@"y";
        }
        else 
        {
            lblText.text=@"f";
        }

    }
    else 
    {
        lblText.text=@"g";
    }
于 2012-07-10T12:58:57.920 回答