I am loading my tblView
with contacts from phone. On tapping a row in that tblView, I can get the name on which it is tapped.
I want to know how to get the contact number on tapping.
After permission, I am storing contacts in array arrContatcs
from this:
let allContacts = ABAddressBookCopyArrayOfAllPeople(addressBookRef).takeRetainedValue() as Array
for record in allContacts {
let currentContact: ABRecordRef = record
let currentContactName = ABRecordCopyCompositeName(currentContact)?.takeRetainedValue()
as? String
if(currentContactName != nil) {
self.arrContacts.append(currentContactName! as String)
}
}
Loading the contacts in tblView
from this:
func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell {
var cell:FriendsCustomCell = self.tblView.dequeueReusableCellWithIdentifier("SimpleTableViewIdentifier") as! FriendsCustomCell
cell.tag = indexPath.row;
cell.lblName!.text = self.arrContacts[indexPath.row] as? String
}
Am printing the name from this:
func tableView(tableView: UITableView, didSelectRowAtIndexPath indexPath: NSIndexPath) {
let indexPath = NSIndexPath(forRow: indexPath.row, inSection: 0)
println("tap name = \(self.arrContacts[indexPath.row])")
}
Now Output
is tap name = John
My Expected Output
is tap name = John and number = ????????
How can I get it?