Write Agent protocol in. h
, abpeoplepickernavigationcontrollerdelegate
Write this code in the. M viewload (where the call is to write where)
Abpeoplepickernavigationcontroller * Picker = [[Abpeoplepickernavigationcontroller alloc] init];
[picker setpeoplepickerdelegate:self];
[self presentviewcontroller:picker animated:YES Completion:nil];
Implementing Proxy methods
#pragma abpeoplepickernavigationcontroller delegate
-(BOOL) Peoplepickernavigationcontroller: (Abpeoplepickernavigationcontroller *) peoplepicker Shouldcontinueafterselectingperson: (abrecordref) person
{
return YES;
}
-(BOOL) Peoplepickernavigationcontroller: (Abpeoplepickernavigationcontroller *) peoplepicker
Shouldcontinueafterselectingperson: (abrecordref) person
Property: (Abpropertyid) property
Identifier: (abmultivalueidentifier) identifier
{
If(property = = Kabpersonphoneproperty) {
Abmutablemultivalueref Phonemulti = Abrecordcopyvalue (person, property);
int index = Abmultivaluegetindexforidentifier (phonemulti,identifier);
nsstring *phone = (nsstring*)cfbridgingrelease(abmultivaluecopyvalueatindex (Phonemulti, index));
Kabpersonfirstnameproperty));
nsstring * str = [phone stringbyreplacingoccurrencesofstring:@ "-" withstring :@ ""];
str = [str stringbyreplacingoccurrencesofstring:@ "+86" withstring:@ ""];
str = [str stringbyreplacingoccurrencesofstring:@ "(" withstring:@ ""]; /c6>
str = [str stringbyreplacingoccurrencesofstring:@ ")" withstring:@ ""];
str = [str stringbyreplacingoccurrencesofstring:@ "" withstring:@ ""];
[_tfphonecode SETTEXT:STR];
Cfrelease (Phonemulti); //c the release of the object
[Peoplepicker dismissviewcontrolleranimated:YES Completion:nil];
}
return NO;
}
Call Address Book code, because I am novice, write this log record