在其他类里实现代理方法时,代理返回可以用segue 获取目标控制器,将代理给当前类ContactsViewController
-(void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender{
//获取目标控制器
id destVc = segue.destinationViewController;
//判断类型
if ([destVc isKindOfClass:[AddContactViewController class]]) {
AddContactViewController *addContactVc = destVc;
addContactVc.delegate = self;
}
}