如何像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;
        }
    }

最佳答案

我认为您无法使用ABPeoplePickerNavigationController来完成您想做的事情。我建议仅创建自己的自定义UIViewController并自行创建联系人tableview。这很容易做到,您可以通过这种方式自定义cellForRowAtIndexPath中的单元,而无需进行任何改动。

关于objective-c - 定制的ABPeoplePickerNavigationController像viber,whatsapp,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/11362936/

10-12 13:57