Reputation: 3071
How to display ABPeoplePickerNavigationController like viber, where viber icon is appearing in front of those contacts who are already using it. Please check the screenshot. Here is the code what i am trying to do but facing issues ...
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;
}
}
Upvotes: 3
Views: 1922
Reputation: 23634
I don't think you can use ABPeoplePickerNavigationController
to do what you're trying to do. I recommend just creating your own custom UIViewController
and making the contacts tableview yourself. It is easy to do and this way you can customize the cells in the cellForRowAtIndexPath
without having to do any hacking.
Upvotes: 3