如何显示像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;
}
}
答案 0 :(得分:3)
我认为您不能使用ABPeoplePickerNavigationController
来做您想做的事情。我建议您自己创建自己的自定义UIViewController
并自行制作联系人tableview。这很容易做到,这样你就可以自定义cellForRowAtIndexPath
中的单元格,而不必进行任何黑客攻击。