Last active
August 29, 2015 13:56
-
-
Save Daniel1of1/8937116 to your computer and use it in GitHub Desktop.
Add an accessory to cells in ABPeoplePickerNavigationController
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Class ABMemberDataSourceClass = NSClassFromString(@"ABMembersDataSource"); | |
SEL originalTableViewMethodSelector = @selector(tableView:cellForRowAtIndexPath:); | |
Method originalTableViewMethod = class_getInstanceMethod(ABMemberDataSourceClass, originalTableViewMethodSelector); | |
SEL newTableViewMethodSelector = @selector(dhc_tableView:cellForRowAtIndexPath:); | |
IMP newTableViewMethodImp = imp_implementationWithBlock(^UITableViewCell * (id __unused _self, UITableView *tableView, NSIndexPath *indexPath){ | |
UITableViewCell *cell=[_self dhc_tableView:tableView cellForRowAtIndexPath:indexPath]; | |
//add to the cell :) eg. | |
cell.accessoryType = UITableViewCellAccessoryCheckmark; | |
// | |
return cell; | |
}); | |
class_addMethod(ABMemberDataSourceClass, newTableViewMethodSelector, newTableViewMethodImp, method_getTypeEncoding(originalTableViewMethod)); | |
method_exchangeImplementations(originalTableViewMethod, class_getInstanceMethod(ABMemberDataSourceClass, @selector(dhc_tableView:cellForRowAtIndexPath:))); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment