MVC - can the Model reference UIImage, etc?

Discussion in 'iOS Programming' started by CaptSaltyJack, Jun 29, 2009.

  1. CaptSaltyJack macrumors 6502

    Joined:
    Jun 28, 2007
    #1
    Let's say I want to define a simple class, "Person." Something like:

    Code:
    class Person : NSObject
    {
      NSString *name;
      int age;
      UIImage *portrait;
    }
    
    Is it OK to use user interface objects in the Model? Is there some other, better way of attaching a user photo to each person?
     
  2. PhoneyDeveloper macrumors 68030

    PhoneyDeveloper

    Joined:
    Sep 2, 2008
    #2
    UIImage is a data object, not a view object. Maybe you meant UIImageView?

    It's perfectly reasonable for a Person object to have a reference to a UIImage related to that Person object. It wouldn't be so good for it to have a ref to a UIImageView.
     
  3. CaptSaltyJack thread starter macrumors 6502

    Joined:
    Jun 28, 2007
    #3
    Nope, I did indeed mean UIImage (data). Cool, that's all I wanted to know.. thanks!
     

Share This Page