5 types of animations in IOS
1.0 UIView Animation;
1Uiimageview *imageview1 = [[Uiimageview alloc] initwithimage:[uiimage imagenamed:@"Page1.png"]];2Imageview1.backgroundcolor =[Uicolor Redcolor];3Imageview1.frame = CGRectMake (0,0, -, $);4 [Self.view Addsubview:imageview1];5 6[Uiimageview beginanimations:@"Test"Context:nil];7[Uiimageview setanimationduration:1];8 9Imageview1.image = [UIImage imagenamed:@"Page2"];TenImageview1.backgroundcolor =[Uicolor Yellowcolor]; OneImageview1.frame = CGRectMake ( -, $, -, $); AImageview1.alpha =0.5; -[Uiimageview commitanimations];
Note: Write UIView animation as long as the integration and UIView control can be used UIView animation;
2.0 UIView Block Animation (this is the block package of the UIView code, which is easier in this way)
1Uiimageview * ImageView2 = [[Uiimageview alloc] initwithimage:[uiimage imagenamed:@"Page2.png"]];2Imageview2.frame = CGRectMake (0,0, -, $);3 [Self.view addsubview:imageview2];4[Uiimageview animatewithduration:1.0fDelay1.0fOptions:uiviewanimationoptionallowanimatedcontent animations:^{5Imageview2.image = [UIImage imagenamed:@"Page1"];6Imageview2.frame = CGRectMake ( -, $, -, $);7Imageview2.alpha =0.1f;8} completion:^ (BOOL finished) {//The position at the end of the animation;9Imageview2.frame = CGRectMake ( -,0, -, $);TenImageview2.alpha =1.0f; One}];
Animation comprehension in iOS