2012-01-03 9 views
0
- (void) touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event{ 


    NSSet *allTouches = [[event allTouches] retain]; 
    switch ([allTouches count]) 
    { 
      case 1: { 
      UITouch *touch = [[allTouches allObjects] objectAtIndex:0]; 
      CGPoint touchPoint = [touch locationInView:[self view]]; 
       if(touchPoint.x > rightleg.frame.origin.x && touchPoint.x < rightleg.frame.origin.x + rightleg.frame.size.width && 
        touchPoint.y > rightleg.frame.origin.y && touchPoint.y < rightleg.frame.origin.y + rightleg.frame.size.height){ 
        rightleg.alpha = rightleg.alpha + 0.005; 
       } 
      } 
     case 2 :{ 
      UITouch *touch = [[allTouches allObjects] objectAtIndex:0]; 
      CGPoint touchPoint = [touch locationInView:[self view]]; 
      if(touchPoint.x > leftleg.frame.origin.x && touchPoint.x < leftleg.frame.origin.x + leftleg.frame.size.width && 
       touchPoint.y > leftleg.frame.origin.y && touchPoint.y < leftleg.frame.origin.y + leftleg.frame.size.height){ 
       leftleg.alpha = leftleg.alpha + 0.005; 

      } 
     } 
    } 


} 

このコードは、ユーザーが画像に触れるとUIImageにアルファに設定されますが、そのピクセルをタッチするとUIImageのピクセルにアルファを設定する方法はありますか?iPhone:PIxelでUIImageのタッチをどのように設定するのですか?

答えて

関連する問題