iOS 8에서 ABPeoplePickerNavigationController의 변경점
Tech 2014. 10. 2. 22:19
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// iOS 8에서는 iOS 7 까지 쓰이던 아래의 델리게이트 메소드가 호출이 안되고 새로운 메소드와 프로퍼티가 추가됨 | |
- (BOOL)peoplePickerNavigationController:(ABPeoplePickerNavigationController *)peoplePicker shouldContinueAfterSelectingPerson:(ABRecordRef)person | |
- (BOOL)peoplePickerNavigationController:(ABPeoplePickerNavigationController *)peoplePicker shouldContinueAfterSelectingPerson:(ABRecordRef)person property:(ABPropertyID)property identifier:(ABMultiValueIdentifier)identifier | |
//iOS 8에서 추가된 델리게이트 메소드 | |
- (void)peoplePickerNavigationController:(ABPeoplePickerNavigationController *)peoplePicker didSelectPerson:(ABRecordRef)person property:(ABPropertyID)property identifier:(ABMultiValueIdentifier)identifier | |
- (void)peoplePickerNavigationController:(ABPeoplePickerNavigationController *)peoplePicker didSelectPerson:(ABRecordRef)person | |
//iOS 8에서 추가된 델리게이트 프로퍼티 | |
@property(nonatomic,copy) NSPredicate *predicateForEnablingPerson | |
@property(nonatomic,copy) NSPredicate *predicateForSelectionOfPerson | |
@property(nonatomic,copy) NSPredicate *predicateForSelectionOfProperty | |
//변경에 대응하는 법 | |
//1. iOS 7 델리게이트 메소드를 부르도록 추가 | |
- (void)peoplePickerNavigationController:(ABPeoplePickerNavigationController *)peoplePicker didSelectPerson:(ABRecordRef)person property:(ABPropertyID)property identifier:(ABMultiValueIdentifier)identifier | |
{ | |
[self peoplePickerNavigationController:peoplePicker shouldContinueAfterSelectingPerson:person property:property identifier:identifier]; | |
} | |
- (void)peoplePickerNavigationController:(ABPeoplePickerNavigationController *)peoplePicker didSelectPerson:(ABRecordRef)person | |
{ | |
[self peoplePickerNavigationController:peoplePicker shouldContinueAfterSelectingPerson:person]; | |
} | |
//2. 기존 shouldContinueAfterSelectingPerson 메소드에서는 리턴값으로 데이터 처리방법을 선택했으나 | |
//iOS 8에서는 추가된 프로퍼티들에 적절한 NSPredicate를 설정하여 제어. | |
peoplePicker.predicateForSelectionOfPerson = [NSPredicate predicateWithFormat:@"%K.@count <= 1", ABPersonPhoneNumbersProperty]; | |
peoplePicker.predicateForSelectionOfPerson = [NSPredicate predicateWithFormat:@"%K.@count <= 1", ABPersonEmailAddressesProperty]; | |
'Tech' 카테고리의 다른 글
OS X Yosemite 설치후 개발관련 설정 (0) | 2014.10.18 |
---|---|
무료 음원 (0) | 2014.10.02 |
Ubuntu設定色々 (0) | 2014.09.27 |
스마트폰 SSL 훔쳐보기 (0) | 2014.09.09 |
한글 11,172자 (0) | 2014.06.20 |