Multiple instances of same custom view

Discussion in 'Mac Programming' started by MacDonaldsd, Sep 26, 2007.

  1. MacDonaldsd macrumors 65816

    MacDonaldsd

    Joined:
    Sep 8, 2005
    Location:
    London , UK
    #1
    Im curious on the theory behind doing this. I wish to have certain view to display an objects details in a specific way (see below). But I wish to have the view repeat for the amount of objects and have them inside the a scroll view.

    How would I deal with repeating the view for the right amount of times ?
     

    Attached Files:

  2. kainjow Moderator emeritus

    kainjow

    Joined:
    Jun 15, 2000
    #2
    You could create a controller class for the view. This controller holds a reference to an object from your model, and an IBOutlet to the view. Then you can initialize each controller separately and add the controller's view to the scroll view.
     
  3. MacDonaldsd thread starter macrumors 65816

    MacDonaldsd

    Joined:
    Sep 8, 2005
    Location:
    London , UK
    #3
    Thanks again kainjow.

    So I would create the NSView once and make instances and add them to the view programatically ?
     
  4. kainjow Moderator emeritus

    kainjow

    Joined:
    Jun 15, 2000
    #4
    Yep, create it once in IB, but instantiate multiple instances in your code.
     

Share This Page