我需要能够以单点触控方式访问地址簿,并在我的项目中从那里添加/修改/删除。我该怎么做?
最佳答案
使用ABAddressBook。以下是添加包含姓名、地址和电话的新联系人的示例
ABAddressBook ab = new ABAddressBook();
ABPerson p = new ABPerson();
p.FirstName = fname;
p.LastName = lname;
ABMutableMultiValue<string> phones = new ABMutableStringMultiValue();
phones.Add(phone, ABPersonPhoneLabel.Mobile);
p.SetPhones(phones);
ABMutableDictionaryMultiValue addresses = new ABMutableDictionaryMultiValue();
NSMutableDictionary a = new NSMutableDictionary();
a.Add(new NSString(ABPersonAddressKey.City), new NSString(city));
a.Add(new NSString(ABPersonAddressKey.State), new NSString(state));
a.Add(new NSString(ABPersonAddressKey.Zip), new NSString(zip));
a.Add(new NSString(ABPersonAddressKey.Street), new NSString(addr1));
addresses.Add(a, new NSString("Home"));
p.SetAddresses(addresses);
ab.Add(p);
ab.Save();
关于iphone - 如何使用单点触控将联系人添加到 iPhone 地址簿?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4821661/