title: iphone::touchesMoved: Move UIImageView inside UIView?
body: <p>This is my code:</p>
  
  <pre><code>- (void) touchesBegan: (NSSet *)touches withEvent: (UIEvent *)event {
  
  CGPoint pt = [[touches anyObject] locationInView:self.view];
  startLocation = pt;
  [super touchesBegan: touches withEvent: event];
  }
  
  -(void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event {
  CGPoint pt = [[touches anyObject] locationInView:self.view];
  CGRect frame = [self.view frame];
  frame.origin.x += pt.x - startLocation.x;
  frame.origin.y += pt.y - startLocation.y;
  [self.view setFrame:frame];
  }
  
  
  - (void)viewDidLoad
  {
  [super viewDidLoad];
  
  UIView *v = [[UIView alloc] initWithFrame: CGRectMake(0, 0, 100, 100)];
  v.backgroundColor = [UIColor redColor];
  
  
  UIImageView *imv = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"boo2.png"]];
  imv.frame = CGRectMake(0, 0, 50, 50);
  [v addSubview:imv];
  
  [self.view addSubview: v];
  [v release];
  
  UIView *v2 = [[UIView alloc] initWithFrame: CGRectMake(100, 100, 100, 100)];
  v2.backgroundColor = [UIColor blueColor];
  
  
  UIImageView *imv2 = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"boo2.png"]];
  imv2.frame = CGRectMake(0, 0, 50, 50);
  [v2 addSubview:imv2];
  
  [self.view addSubview: v2];
  [v2 release];
  }
  </code></pre>
  
  <p>What I want to do is to move the UIImageView inside the UIView, not the entire view. But, the code above, when I try to drag, it moves the entire view.</p>
  
  <p>NOTE: The images are return from others functions, not declared in viewdidload. Assume, you cant declare UIImageView variables.</p>