私のアプリで画像をクリックして画像が一番上にある場合、画像は常に完全に下に移動します。しかし、画像が下にある場合、画像が上に移動しないことがあります。移動はしませんが、プロセスは引き続き実行され、最上位にあるかのようにログに記録されます。知っていることはすべて試しましたが、何か問題がありましたか?ありがとう!!
- (void )imageTapped:(UITapGestureRecognizer *) gestureRecognizer
{
NSLog(@"imageTapped");
[UIView beginAnimations:@"move" context:nil];
[UIView setAnimationDuration:0.3];
if (self.imgV.frame.origin.y == 20) {
NSLog(@"Top");
upOrDown = @"1";
self.invalidateTheTimer = @"";
timer = [NSTimer scheduledTimerWithTimeInterval:1.0 target:self selector:@selector(updateLabel) userInfo:nil repeats:YES];
self.imgV.frame=CGRectMake(0, self.view.frame.size.height-self.imgV.frame.size.height, self.imgV.frame.size.width, self.imgV.frame.size.height);
self.vBottom.frame=CGRectMake(0, self.imgV.frame.origin.y+self.imgV.frame.size.height, self.vBottom.frame.size.width, self.vBottom.frame.size.height);
} else if (self.imgV.frame.origin.y >= 507) {
NSLog(@"Bottom");
self.imgV.frame=CGRectMake(0, 20, self.imgV.frame.size.width, self.imgV.frame.size.height);
self.vBottom.frame=CGRectMake(0, self.imgV.frame.origin.y+self.imgV.frame.size.height, self.vBottom.frame.size.width, self.vBottom.frame.size.height);
[hour setText:@""];
[minute setText:@""];
[second setText:@""];
[timer invalidate];
self.invalidateTheTimer = @"INVALIDATE";
}
NSLog(@"%f", self.imgV.frame.origin.y);
[UIView commitAnimations];
}