淡入淡出效果的实现

 

//淡入淡出效果
- (void) appear
{
    CGContextRef contextf = UIGraphicsGetCurrentContext();
    [UIView beginAnimations:nil context:contextf];
    [UIView setAnimationCurve:UIViewAnimationCurveEaseInOut];
    [paintToolView setAlpha:1.0];
    [UIView setAnimationDuration:4.0f];
    [UIView commitAnimations];
}

- (void) disappear
{
    CGContextRef contextf = UIGraphicsGetCurrentContext();
    [UIView beginAnimations:nil context:contextf];
    [UIView setAnimationCurve:UIViewAnimationCurveEaseInOut];
    [UIView setAnimationDuration:1.0];
    [paintToolView setAlpha:0.0f];
    [UIView commitAnimations];
}
动画是否正常演示出,跟调用处的上下文有很大的关系。

你可能感兴趣的:(实现)