2011-08-06 113 views

回答

3
UIImage *img = [UIImage imageNamed:@"yourimage.png"]; 
NSData *dataRef = UIImagePNGRepresentation(img); 
ABPersonSetImageData(person, (CFDataRef)dataRef, nil); 
+0

對不起,但這不適合我。我在模擬器中測試這個。他們是否需要在此代碼中添加其他內容? –

+0

你必須實現http://developer.apple.com/library/mac/#documentation/UserExperience/Reference/AddressBook/Classes/ABPerson_Class/Reference/Reference.html – PJR

+0

Thnx @PJR我終於解決了我的問題這個線程http://stackoverflow.com/questions/2082845/setting-address-book-image-for-a-contact-doesnt-seem-to-work –