I have a simple Document based Core Data app (built around the standard Apple tutorials). At the moment I have a button connected to the add: method of a controller (Sheet Controller) that drops down a modal sheet from the main document window. The connection is made in IB (see below from MyDocument.xib). There is also another controller (Another Controller)

My question is how do I programatically change the buttons action method to point to a method in ‘Another Controller’ instead of the ‘Sheet Controller it is wired up to in IB
Many Thanks
Just use the NSControl
setTargetandsetActionmethods.There is some special magic associated with making the connections hang together in the first place, but once it’s all wired up in the running application a connection is a connection regardless of how it was originally made.
Although — it’s worth considering whether you could allow the responder chain to take care of things rather than explicitly retargeting the action yourself. That, at least in part, is what it’s there for…