objective-c - 自定义 ABPeoplePickerNavigationController 像 viber, whatsapp

标签 objective-c ios

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

enter image description here

最佳答案

我不认为你可以使用 ABPeoplePickerNavigationController 来做你想做的事。我建议只创建您自己的自定义 UIViewController 并自己制作联系人 TableView 。这很容易做到,并且您可以通过这种方式自定义 cellForRowAtIndexPath 中的单元格,而无需进行任何修改。

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

相关文章:

iphone - objective-c -获取空值

android - Future <List <String>> 在迭代图像列表时返回 null

ios - 向使用 UIViewRepresentable 创建的按钮添加操作

ios - 如何将 UICollectionView 中的单元格一个接一个地放置

objective-c - 在 Objective-C 中创建匿名委托(delegate)对象

ios - Swift 面向协议(protocol)编程 : Can Protocol Extension Property Have Same Name As Base Class Property

iphone - 在 Objective-C 中执行一系列 SOAP 请求的更好方法

iphone - 使用一个代码库 : framework for scaling layouts and assets for HTML5 apps on iPhones or iOS devices? 为非 Retina 和 Retina 显示器提供服务

推送/弹出第二个 View Controller 后,iOS UI 导致崩溃

objective-c - 在不激活的情况下显示窗口(保持其下方的应用程序处于事件状态)