在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
代理声明: //oc调用代理 @objc(NurseListCellDelegate) protocol NurseListCellDelegate : NSObjectProtocol{ func nurseListCellDidClickedDeleteNurseAction(nurseListCell: NurseListCell) func nurseListCellDidClickedFreezeNurseAction(nurseListCell: NurseListCell) } class NurseListCell: UITableViewCell{ weak var delegate : NurseListCellDelegate? } 代理触发 func delNurseAction() { if (delegate != nil && (delegate?.respondsToSelector(Selector("nurseListCellDidClickedDeleteNurseAction")))!) { delegate!.nurseListCellDidClickedDeleteNurseAction(self) } } func freezeNurseAction() { if (delegate != nil && (delegate?.respondsToSelector(Selector("nurseListCellDidClickedFreezeNurseAction")))!) { delegate!.nurseListCellDidClickedFreezeNurseAction(self) } } 代理使用 //在oc中创建后,直接添加代理 nurseCell.delegate = self; //实现 - (void)nurseListCellDidClickedDeleteNurseAction:(NurseListCell *)nurseListCell{ NSLog(@"%s",__func__); } - (void)nurseListCellDidClickedFreezeNurseAction:(NurseListCell *)nurseListCell{ NSLog(@"%s",__func__); }
|
请发表评论