我正在尝试为其中包含一些UILabel的UIView制作动画。它在4英寸的模拟器上按预期工作,而不是3.5英寸。我没有看到这里有什么问题,因为它甚至打印出具有预期值的所有NSLog(包括一个内部完成的块),但没有动画。
我从viewDidAppear调用此方法。
-(void)animateSlidingView:(NSString *)mode
{
NSLog(@"animateSlidingView with mode = %@", mode);
CGRect rect;
if ([mode isEqualToString:@"YES"])
{
rect = CGRectMake(-600, slidingView.frame.origin.y, slidingView.frame.size.width, slidingView.frame.size.height);
}
else if ([mode isEqualToString:@"NO"])
{
rect = CGRectMake(0, slidingView.frame.origin.y, slidingView.frame.size.width, slidingView.frame.size.height);
}
else
return;
NSLog(@"Rect = %f,%f,%f,%f,", rect.origin.x,rect.origin.y,rect.size.width,rect.size.height);
[UIView animateWithDuration:0.4 delay:0 options:UIViewAnimationOptionCurveEaseInOut animations:^(void) { slidingView.frame = rect; }
completion:^(BOOL finished){
NSLog(@"Animation Completed");
}];
}