【转】淡入淡出效果的实现

 

//淡入淡出效果
- (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];
}
动画是否正常演示出,跟调用处的上下文有很大的关系。

posted @ 2012-05-04 14:44  编程小翁  阅读(551)  评论(1编辑  收藏  举报
我是来自厦门的Jilon. 翁,请关注我的微博:真实的weng,或关注微信:Jilon