UIImageView not responding to touch

Discussion in 'iOS Programming' started by drf1229, Jan 16, 2010.

  1. drf1229 macrumors regular

    drf1229

    Joined:
    Jun 22, 2009
    #1
    For some odd reason a UIImageView doesn't respond to when I touch it. Heres what I mean:

    Code:
     
    - (void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event {
    UITouch *touch = [touches anyObject];
    	
    	//imageview and maskimage are UIImageViews
          
    
    //and for some reason this works...
        if ([touch view]==maskimage) {
    		
    		CGPoint location = [touch locationInView:self.view];
            
    		maskimage.center=location;
    		return;
    		
        }
    
    //Yet this doesn't
    if ([touch view]==imageview) {
    		
    		CGPoint location = [touch locationInView:self.view];
            imageview.center = location;
    		
    		return;
    		 }
    	
    }
    So thats my dilemma. UserInteractionEnabled is on for both of the images. Any advice is greatly appreciated!
     
  2. drf1229 thread starter macrumors regular

    drf1229

    Joined:
    Jun 22, 2009
    #2
    I found what the problem was! I never called the size for the ImageView when I created it, so the frame was completely off.
     

Share This Page