您需要定义一个委托委托协议并将一个delegate
属性添加到NotesController
.
在协议中,应该有一个方法,例如:
- (void)notesController:(NotesController*)nc didFinishWithText:(NSString*)text;
在你的NotesController
:
@property (nonatomic, weak) id<NotesControllerDelegate> delegate;
现在,在呈现之前,将委托设置为呈现视图控制器:
NotesController *vcNotes = [self.storyboard instantiateViewControllerWithIdentifier:@"FullNotes"];
vcNotes.delegate = self;
[self presentViewController:vcNotes animated:YES completion:nil];
现在,在您的笔记控制器中,当您准备好时,调用委托方法:
[self.delegate notesController:self didFinishWithText:self.text];