The ABPersonViewControllerDelegate
protocol requires that the method func personViewController(personViewController: ABPersonViewController!, shouldPerformDefaultActionForPerson person: ABRecord!, property: ABPropertyID, identifier: ABMultiValueIdentifier) -> Bool
be implemented.
It's called whenever a user selects any piece of contact information in an ABPersonViewController
, and it holds all the information necessary to describe a contact: the property
and identifier
parameters.
The ABPersonViewController
class also contains func setHighlightedItemForProperty(_ property: ABPropertyID, withIdentifier identifier: ABMultiValueIdentifier)
, which highlights the piece of contact information described by its parameters.
Simply combining these two functions, I would think that if I wanted to highlight any information the user selects, it would be as simple as:
func personViewController(personViewController: ABPersonViewController!,
shouldPerformDefaultActionForPerson person: ABRecord!,
property: ABPropertyID, identifier: ABMultiValueIdentifier) -> Bool {
personViewController.setHighlightedItemForProperty(property, withIdentifier: identifier)
}
This however, seems to have zero bearing, and there is no visible highlight aside from the ephemeral one which always occurs when an item of contact information is pressed on (to be clear: I want the highlight to last, at least until the user presses that item again).
EDIT: If this (i.e. the temporary highlight) is indeed the intended behavior, how can I implement or modify this function so that the highlight persists (until it's shut off). This seems especially difficult given that ABPersonViewController
is unsubclassable (a word perhaps of my own invention).