我对UIView有一个问题,当使用纯色作为背景时,动画效果非常好。
图像的背景色是预先设置好的,就像这样(这会搞乱动画):
UIImage *loadedImage = [UIImage imageNamed:@"MyTexture.png"];
UIColor *tempColour = [[UIColor alloc] initWithPatternImage:loadedImage];
[myUIView setBackgroundColor:tempColour];
[tempColour release];
但是,将背景色设置为“纯色”可以使动画正常工作:
[myUIView setBackgroundColor:[UIColor blackColor]];
我正在使用的动画:
[UIView beginAnimations:nil context:NULL];
[UIView setAnimationDuration:0.5];
[UIView setAnimationTransition:UIViewAnimationCurveLinear forView:myUIView cache:YES];
[myUIView setHidden:YES];
[UIView commitAnimations];