MVC - can the Model reference UIImage, etc?

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

  1. CaptSaltyJack macrumors 6502

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

    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 68040


    Sep 2, 2008
    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

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

Share This Page