3

如何像 viber 一样显示 ABPeoplePickerNavigationController,其中 viber 图标出现在那些已经在使用它的联系人面前。请检查屏幕截图。这是我正在尝试做但面临问题的代码...

ABPeoplePickerNavigationController *picker = [[ABPeoplePickerNavigationController alloc] init];

    picker.navigationBar.tintColor = [UIColor colorWithRed:33.0f/255.0f green:54.0f/255.0f blue:63.0f/255.0f alpha:0.20f];

    picker.peoplePickerDelegate = self;

    [self presentModalViewController:picker animated:YES];

    UIView *view = picker.topViewController.view; 
    UITableView *tableView = nil;
    for(UIView *uv in view.subviews)
    {
        if([uv isKindOfClass:[UITableView class]])
        {
            tableView = (UITableView*)uv; 

            UIImageView *imageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"logoIcon"]];

            NSLog(@"NumberOfSection<--->%d",[tableView numberOfSections]);

            NSLog(@"NumberOfRows=%dInSection=%d",[tableView numberOfRowsInSection:i], i);

            for (int i = 0; i < [tableView numberOfSections]; i++)
            {
                for (int j = 0; j < [tableView numberOfRowsInSection:i]; j++)
                {
                    UITableViewCell *celll = [tableView cellForRowAtIndexPath:[NSIndexPath indexPathForRow:j inSection:i]];

                    celll.accessoryView = imageView;

                    NSLog(@"currentIndex=>%@",celll.accessoryView);

                    celll = nil;
                }
            }

            break;
        }
    }

在此处输入图像描述

4

1 回答 1

3

我不认为你可以ABPeoplePickerNavigationController用来做你想做的事。我建议只创建自己的自定义UIViewController并自己制作联系人表格视图。这很容易做到,这样您就可以自定义单元格,cellForRowAtIndexPath而无需进行任何黑客攻击。

于 2012-07-06T14:10:55.073 回答