cncontactpicker

How to change color of CNContactPickerViewController searchBar

丶灬走出姿态 提交于 2019-12-21 09:19:18
问题 I start a CNContactPickerViewController from a viewcontroller, but how can I change the textcolor of the searchbar inside it. The navigationbar is dark blue, in iOS11 the default searchbartext is black. 回答1: I updated the way to fix in swift Before you present CNContactPickerViewController, you should set background color of UISearchBar UISearchBar.appearance().backgroundColor = UIColor.white let cancelButtonAttributes = [NSForegroundColorAttributeName: ColorConstant.baseColorGray]

select multiple properties from single contact in CNContactPicker

浪子不回头ぞ 提交于 2019-12-13 05:30:41
问题 I am trying to use the CNContactPickerViewController and keep running into issues with how to pick multiple properties from a single contact Basic display of the picker let contactStore = CNContactStore() override func viewDidLoad() { super.viewDidLoad() self.askForContactAccess() self.displayContacts() } func displayContacts(){ let contactPicker = CNContactPickerViewController() contactPicker.delegate = self self.present(contactPicker, animated: true, completion: nil) } this displays the

How to get the selected contact from CNContactPicker

北城余情 提交于 2019-12-11 18:16:32
问题 I'm currently able to get a contact from the contacts app, but the problem I'm facing that I need to be able to select the contact I want to import to my app , if the contact have more than 1 phone number, I always get the first number, here is the code I'm using: func contactPicker(_ picker: CNContactPickerViewController, didSelect contactProperty: CNContactProperty) { let numbers = contactProperty.contact.phoneNumbers.first let firstName = contactProperty.contact.givenName let lastName =

iOS Swift: Get user selected phone number from CNContactProperty as a string [duplicate]

六月ゝ 毕业季﹏ 提交于 2019-12-10 11:39:46
问题 This question already has answers here : How to get a CNContact phone number(s) as string in Swift? (9 answers) Closed 2 years ago . As the title suggests, in my iOS app using swift I've got a CNContactProperty object and I want to extract the phone number from it as a string. The CNContact property is returned from the standard CNContactPickerViewController via the delegate protocol function, after the user has selected a contact from it. When a contact has multiple phone numbers, I want to

iOS Swift: Get user selected phone number from CNContactProperty as a string [duplicate]

落花浮王杯 提交于 2019-12-09 04:24:26
This question already has answers here : How to get a CNContact phone number(s) as string in Swift? (9 answers) Closed 2 years ago . As the title suggests, in my iOS app using swift I've got a CNContactProperty object and I want to extract the phone number from it as a string. The CNContact property is returned from the standard CNContactPickerViewController via the delegate protocol function, after the user has selected a contact from it. When a contact has multiple phone numbers, I want to be able to extract the one that the user tapped on in the contact view from the CNContactProperty. I'm