Luc*_*iga 1 objective-c uiview
我想在UIView这里动画一下.它看起来像一个矩形,我只想把它翻译成我的协调.
那么,我该如何制作动画呢?我试图找到一些教程,但没有成功.
小智 20
在iOS 4中,UIView块动画方法最简单:
[UIView animateWithDuration:1.0 animations:^{
myView.frame = myNewFrameRect;
}];
Run Code Online (Sandbox Code Playgroud)
Wil*_*ill 15
以下是动画离开屏幕的视图的示例.您应该可以根据需要稍微调整一下:
[UIView beginAnimations:@"bucketsOff" context:nil];
[UIView setAnimationDuration:0.4];
[UIView setAnimationDelegate:self];
//position off screen
[bucketView setCenter:CGPointMake(-160, 377)];
[UIView setAnimationDidStopSelector:@selector(finishAnimation:finished:context:)];
//animate off screen
[UIView commitAnimations];
Run Code Online (Sandbox Code Playgroud)
//try this AnimationTransitionCurlDown \UP
-(void)pageDown
{
[UIView beginAnimations:nil context:NULL];
[UIView setAnimationDuration:1.0];
[UIView setAnimationTransition:UIViewAnimationTransitionCurlDown forView:self cache:YES];
[UIView commitAnimations];
}
-(void)pageUP
{
[UIView beginAnimations:nil context:NULL];
[UIView setAnimationDuration:1.0];
[UIView setAnimationTransition:UIViewAnimationTransitionCurlDown forView:self cache:YES];
[UIView commitAnimations];
}
//flip uiviews using animation
-(void)FlipFromLeft
{
[UIView beginAnimations:nil context:NULL];
[UIView setAnimationDuration:1.0];
[UIView setAnimationTransition:UIViewAnimationTransitionFlipFromLeft forView:self cache:YES];
[UIView commitAnimations];
}
-(void)FlipFromRight
{
[UIView beginAnimations:nil context:NULL];
[UIView setAnimationDuration:1.0];
[UIView setAnimationTransition:UIViewAnimationTransitionFlipFromRight forView:self cache:YES];
[UIView commitAnimations];
}
Run Code Online (Sandbox Code Playgroud)