title: Add a UIImageView to a UIView
body: <p>Ive been stuck on this for a while now so any help will be greatly appreciated.</p>
  
  <p>I have basically made a class called shape which is a <code>UIView</code> and I want to add an <code>UIImageView</code> to that <code>UIView</code>.</p>
  
  <p>Here is my .h file:</p>
  
  <pre><code>@interface Shape : UIView {
  
   int blockWidth;
   int blockHeight;
   NSString *colour;
  
   IBOutlet UIImageView *blockView;
  
  }
  
  @property (nonatomic, retain) IBOutlet UIImageView *blockView;
  @property (nonatomic, retain) NSString *colour;
  
  -(void)setColour:(NSString *)colour;
  -(void)createShape:(int)blocksX :(int)blocksY;
  
  
  @end
  </code></pre>
  
  <p>And here is my .m file:</p>
  
  <pre><code>@implementation Shape
  
  @synthesize blockView;
  @synthesize colour;
  
  - (void)setColour:(NSString *)colour{
   NSLog(@"Colour: %@", colour);
  }
  
  -(void)createShape:(int)blocksX :(int)blocksY{
   self.frame = CGRectMake(0, 0, 200, 200);
   blockView.frame = CGRectMake(0, 0, 100, 100);
  
   self.backgroundColor = [UIColor greenColor];
   blockView.backgroundColor = [UIColor redColor];
   [self addSubview:blockView];
  
  }
  
  - (void)dealloc {
  
   [blockView release];
   [colour release];
   [super dealloc];
  }
  
  
  @end
  </code></pre>
  
  <p>Thanks a lot!</p>
  
  <p>Hey Again sorry if this is confusing but Im trying to port this c sharp code into objective, the code above is my first attempt and is obviously no where need finished but you can hopefully see what I'm trying to acheive, sorry but Im completely new to Objective C and it is completely different to other languages I am use to :S</p>
  
  <pre><code>public class Shape : UIView
      {
          public UIImageView blockView;
  
          private int blockWidth = 40;
          private int blockHeight = 40;
  
  
          public Shape (int startX, int startY ,string colour, int blocksX, int blocksY)
          {
              Console.WriteLine("Colour: "+colour+" Blocks: "+blocksX+" "+blocksY);
  
              this.Frame = new RectangleF(startX,startY,blockWidth*blocksX,blockHeight*blocksY);
              this.UserInteractionEnabled = true;
  
  
              for(int i = 0; i&lt;blocksX; i++)
              {
                  for(int j = 0; j&lt;blocksY; j++)
                  {
                      blockView = new UIImageView(UIImage.FromFile("Images/Blocks/"+colour+"block.jpg"));
                      blockView.Frame = new RectangleF(blockWidth*i,blockHeight*j,blockWidth,blockHeight);
                      Console.WriteLine("I: "+i+" J: "+j);
                      this.AddSubview(blockView);
                  }
              }
          }   
  </code></pre>