我使用 UISwipeGestureRecognizer 注册我的视图以识别向左或向右滑动。响应操作为:
[UIView beginAnimations:@"slide" context:nil];
[UIView setAnimationDuration:4];
[UIView setAnimationCurve:UIViewAnimationCurveEaseInOut];
CGRect frame = self.sliderImageView.frame;
if (recognizer.direction == UISwipeGestureRecognizerDirectionLeft )
{
frame.size.width = 0;
self.sliderImageView.frame = frame;
}
else if (recognizer.direction == UISwipeGestureRecognizerDirectionRight)
{
frame.size.width = 199;
self.sliderImageView.frame = frame;
}
[UIView commitAnimations];
如果有可能获得self.sliderImageView.frame.width
显示视图的?因为我在使用动画期间尝试这样做的NSLog(@"%f", self.sliderImageView.frame.size.width)
是 0 或 199。那么有什么方法可以得到frame.width
?