AddressBookUI API를 iOS 5 앱에 통합하여 선택한 내용을 테이블보기에 표시하려고합니다. AddressBook Picker를 구현하고 사용자가 주소록에서 사람을 선택하면 TableView에서 셀의 레이블을 채우도록 설정할 수있었습니다. 또한 같은 셀에있는 선택된 사람의 이미지와 존재하지 않는 경우 누락 된 기본 이미지를 표시 할 수 있기를 바랍니다.UITableViewCell의 iOS 주소록 이미지 설정
같은 TableView 셀에 이름과 이미지 데이터를 저장하는 방법에 대해 머리를 터지려면 볼 수 없습니다.
누구든지이 작업을 어떻게 수행할지 제안합니다. 개발자 문서를 읽고 ABPersonCopyImageDataWithFormat 명령을 사용해야한다는 것을 알고 있습니다. 난 그냥 tableview 셀로 구현 얻을 수없는 것. 여기
내가 지금까지 가지고 코드의 조각입니다
// Store the name into memory when the user selects, then dismiss the view.
- (BOOL)peoplePickerNavigationController:(ABPeoplePickerNavigationController *)peoplePicker shouldContinueAfterSelectingPerson:(ABRecordRef)person
{
NSString *selectedPerson = (__bridge NSString *)ABRecordCopyCompositeName(person);
[people insertObject:selectedPerson atIndex:0];
if (ABPersonHasImageData(person) == TRUE) {
NSLog(@"Person has an image!");
} else {
NSLog(@"Person does not have an image.");
}
[self dismissModalViewControllerAnimated:YES];
[self.tableView reloadData];
return NO;
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
PartyCell *cell = (PartyCell *)[tableView dequeueReusableCellWithIdentifier:@"Cell"];
cell.backgroundView = [[GradientView alloc] init];
cell.personLabel.text = [people objectAtIndex:indexPath.row];
cell.personImage.image = [UIImage imageNamed:@"missing.png"]; // THIS NEEDS TO DISPLAY THE SELECTED USERS PICTURE. CURRENTLY SHOWS A DEFAULT USER.
return cell;
}
감사합니다!
의 배열을 호출하여 세포에 정상처럼로드 할 수 있지만 나를 위해 작동하지 않습니다. 내가 작업중인 코드의 두 섹션으로 원래 게시물을 편집했습니다. – Brian