Displaying data on a tableView: Calling contacts from a picker to tableView 29 and counting

隐身守侯 提交于 2019-12-23 05:00:34

问题


Aaanyway, I wanted to ask if its possible to populate a table view from my contacts picker. I'm using this library: https://github.com/ipraba/EPContactsPicker

This is my picker:

///CONTACTS PICKER\\\

@IBAction func onTouchShowMeContactsButton(sender: AnyObject) {

    let contactPickerScene = EPContactsPicker(delegate: self, multiSelection:true, subtitleCellType: SubtitleCellValue.Email)
    let navigationController = UINavigationController(rootViewController: contactPickerScene)
    self.presentViewController(navigationController, animated: true, completion: nil)

}

//MARK: EPContactsPicker delegates
func epContactPicker(_: EPContactsPicker, didContactFetchFailed error : NSError)
{
    print("Failed with error \(error.description)")
}

func epContactPicker(_: EPContactsPicker, didSelectContact contact : EPContact)
{
    print("Contact \(contact.displayName()) has been selected")
}

func epContactPicker(_: EPContactsPicker, didCancel error : NSError)
{
    print("User canceled the selection");
}

func epContactPicker(_: EPContactsPicker, didSelectMultipleContacts contacts: [EPContact]) {
    print("The following contacts are selected")
    for contact in contacts {
        print("\(contact.displayName())")
    }

After I select the contacts I want to be able to show them on the table view like this: TableView

If there is no answer or if You guys think I don't deserve the help due to my lack of experience, please send me the aid through tutorials of some sort or any relatable information of some sort. Thank y'all for the time and effort. <3


回答1:


To get the contact details from phone you can use the apple library, ABAddressBookRef

Please check the apple documentation



来源:https://stackoverflow.com/questions/34981392/displaying-data-on-a-tableview-calling-contacts-from-a-picker-to-tableview-29-a

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!