Touchesbegan und touchesmoved Funktionen arbeiten nicht auf UIImageView

Ich bin mit diesen 2 Funktionen in meinem FYImageSequence.m-Datei.Ich erbte die Klasse von UIImageView

@interface FVImageSequence : UIImageView

War ich in der Lage, verbinden Sie diesen Anschluss mit meinem UIImageView im storyboard.Aber, wie Sie die Funktionen unten arbeiten.Gibt es irgendwelche verbindungen, die getan werden sollte.

-(void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event{
if(increment == 0)
    increment = 1;
    [super touchesBegan:touches withEvent:event];

    UITouch *touch = [[event allTouches] anyObject];
    CGPoint touchLocation = [touch locationInView:self];
    previous = touchLocation.x;
}

-(void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event {
[super touchesMoved:touches withEvent:event];

    UITouch *touch = [[event allTouches] anyObject];
    CGPoint touchLocation = [touch locationInView:self];
int location = touchLocation.x;

if(location < previous)
    current += increment;
else
    current -= increment;

previous = location;

if(current > numberOfImages)
    current = 0;
if(current < 0)
    current = numberOfImages;

NSString *path = [NSString stringWithFormat:@"%@%d", prefix, current];
NSLog(@"%@", path);

path = [[NSBundle mainBundle] pathForResource:path ofType:extension];


UIImage *img =  [[UIImage alloc] initWithContentsOfFile:path];

[self setImage:img];
}
InformationsquelleAutor | 2013-12-10
Schreibe einen Kommentar