Reputation: 467
I open child window from parent window using below code:
if (!loginWindow) {
loginWindow = [[LoginController alloc]initWithWindowNibName:@"LoginWindow"];
}
[loginWindow showWindow:self];
What I want is, in the child window (loginWindow), If user clicks on OK button, I need to get the response in parent.
ex :
if ([loginWindow showWindow:self] == OK clicked) //THis is just algorithm
{
//do something
}
How can we achieve this in Cocoa/Objective C?
Upvotes: 0
Views: 379
Reputation: 3663
When You want to some change in a class by firing some action in other class then in this case use delegate method if you know how to use delegate then make a delegate method otherwise follow this link
Upvotes: 1
Reputation: 6557
You need to create a delegate in the child view controller, set the delegate to be the parent view controller, and when the ok button is clicked, you call the delegate method.
Upvotes: 0