Reputation: 59
From the names , one is will , one is should , When I implement windowShouldClose it worked fine. When I implement windowWillClose it worked fine.
But , when I implement two of them , only windowShouldClose work , why?
Upvotes: 1
Views: 741
Reputation: 56625
In Cocoa it is a common pattern to have ...should...
delegate methods that return a BOOL
. The delegate is asking you if it should do something. When it gets your answer back if checks if you think it should do it and then it informs you that it will do something (if you said YES). Later you get a third callback that it did do something (when it is finishes).
Upvotes: 2