2012-07-02 1 views

답변

2

샘플 코드를 요청하는 것 같습니다. UIImageView의 클래스 하위 클래스를 만들 수 있습니다. 마찬가지로 :

.H

@interface YourImageController : UIImageView 
{ 
    CGPoint startLocation; 
} 
@end 

하는 .m

@implementation YourImageController 
- (void) touchesBegan:(NSSet*)touches withEvent:(UIEvent*)event { 
    [self setAlpha:x.x]; 

    // Retrieve the touch point 
    CGPoint pt = [[touches anyObject] locationInView:self]; 
    startLocation = pt; 
} 

-(void) touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event { 
    [self setAlpha:x.x]; 
    CGPoint pt = [[touches anyObject] locationInView:self]; 
    CGFloat dx = pt.x - startLocation.x; 
    CGFloat dy = pt.y - startLocation.y; 

    CGPoint newCenter = CGPointMake(self.center.x + dx, self.center.y + dy); 

    self.center = newCenter; 
} 
-(void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event 
{ 
    [self setAlpha:1.0]; 
} 
2

image.alphatouchesBegan에를 줄입니다. touchesEnd로 증가 시키십시오.

관련 문제