View - Controller - Model question

Discussion in 'Mac Programming' started by ryanknu, Nov 1, 2008.

  1. ryanknu macrumors newbie

    Joined:
    Sep 12, 2008
    #1
    Hey, I'm not even sure if this is possible but I'm stumped by this one. I set up a program with a model to hold the data and do the calculations, a controller to connect outlets and call methods on the model, and a custom view to put it all together. But I'm having a problem figuring out how to call a controller method from within the custom view, because of the way IB instantiates it separately from my code. Is it possible to hold onto a pointer to the controller inside the view, or is there a better way to do this?
     
  2. SydneyDev macrumors 6502

    Joined:
    Sep 15, 2008
    #2
    You usually put the Controller in the NIB file and put an outlet to the view on it. To instantiate one of your own classes in a NIB, drag an NSObject from the Palette and then set the class to your class in the identity tab of the IB inspector.
     
  3. ryanknu thread starter macrumors newbie

    Joined:
    Sep 12, 2008
    #3
    My view is an outlet on my controller, but what I want is to do the same thing, only the other way around. I also want my view to have an outlet to the controller, so that it can tell the controller when to do stuff.
     

Share This Page