首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 移动开发 > 移动开发 >

UIview容易动画

2012-09-18 
UIview简单动画//简单移动imageView.transform CGAffineTransformIdentityimageView.frameCGRectMake(

UIview简单动画


//简单移动

imageView.transform = CGAffineTransformIdentity;

imageView.frame=CGRectMake(0, 100, 320, 320);

[UIView beginAnimations:@"clearmemory"context:imageView];

[UIView setAnimationDelegate:self];

[UIView setAnimationDidStopSelector:@selector(enablebutton)];

imageView.frame=CGRectMake(34, 0, 320, 320);  

[UIView commitAnimations];


//动画曲线

    [UIView beginAnimations:nilcontext:nil];

    [UIView setAnimationDuration:1];

    [UIView setAnimationDelegate:self];

    [UIView setAnimationCurve:UIViewAnimationCurveEaseIn];

    // UIViewAnimationCurveEaseInOut,         // slow at beginning and end

    //UIViewAnimationCurveEaseIn,            // slow at beginning

    //UIViewAnimationCurveEaseOut,           // slow at end

    //UIViewAnimationCurveLinear             //恒定速度

    [UIView setAnimationDidStopSelector:@selector(enablebutton:)];

    imageView.frame=CGRectMake(22, 0, 320, 320);

    [UIView commitAnimations];

//反向重复 


    [UIView beginAnimations:@"animation3" context:imageView1];

    [UIView setAnimationCurve:UIViewAnimationCurveLinear];

    [UIView setAnimationDuration:1.0];

    [UIView setAnimationRepeatAutoreverses:YES];

    [UIView setAnimationRepeatCount:10];

    [UIView setAnimationDelegate:self];

    [UIView setAnimationDidStopSelector:@selector(enablebutton:)];

    imageView1.alpha=0;

    [UIView commitAnimations]; 

 

 // 延时,缓入,缓出

    

    [UIView beginAnimations:nil context:nil];

    [UIView setAnimationDelay:0.5];

    [UIView setAnimationDuration:1.5];

    [UIView setAnimationCurve:UIViewAnimationCurveEaseIn];

    

    [UIView setAnimationRepeatAutoreverses:YES];

    [UIView setAnimationRepeatCount:2];

    [UIView setAnimationDelegate:self];

    [UIView setAnimationDidStopSelector:@selector(enablebutton:)];

    imageView.frame=CGRectMake(120, 0, 200, 200);

    [UIView commitAnimations];

   

-(void)enablebutton:(id)sender

{

    imageView.transform=CGAffineTransformIdentity;

    imageView.frame=CGRectMake(0, 0, 200, 200);

    //btn.enabled=NO;

}


    




热点排行