`

uiview动画

 
阅读更多

返回一个布尔值表示动画是否结束。+ (BOOL)areAnimationsEnabled返回值如果动画结束返回YES,否则NO。


beginAnimations:context:

开始一个动画块+ (void)beginAnimations:(NSString *)animationID context:(void *)context参数animationID动画块内部应用程序标识用来传递给动画代理消息-这个选择器运用setAnimationWillStartSelector:和setAnimationDidStopSelector: 方法来设置。context附加的应用程序信息用来传递给动画代理消息-这个选择器使用setAnimationWillStartSelector: 和setAnimationDidStopSelector: 方法。讨论这个值改变是因为设置了一些需要在动画块中产生动画的属性。动画块可以被嵌套。如果在没有在动画块中调用那么setAnimation类方法将什么都不做。使用 beginAnimations:context:来开始一个动画块并用commitAnimations类方法来结束一个动画块。


commitAnimations

结束一个动画块并开始当他在动画块外时。+ (void)commitAnimations讨论如果当前的动画块是最外层的动画块,当应用程序返回到循环运行时开始动画块。动画在一个独立的线程中所有应用程序不会中断。使用这个方法,多个动画可以被实现。查看setAnimationBeginsFromCurrentState:来了解如果开始一个动画当另外一个动画在播放的时候。


layerClass

返回类用来创建这一个本类的layer实例对象。+ (Class)layerClass返回值一个用来创建视图layer的类讨论重写子类来指定一个自定义类用来显示。当在创建视图layer时候调用。默认的值是CALayer类对象。


setAnimationBeginsFromCurrentState:

设置动画从当前状态开始播放。+ (void)setAnimationBeginsFromCurrentState:(BOOL)fromCurrentState参数fromCurrentStateYES如果动画需要从他们当前状态开始播放。否则为NO。讨论如果设置为YES那么当动画在运行过程中,当前视图的位置将会作为新的动画的开始状态。如果设置为NO,当前动画结束前新动画将使用视图最後状态的位置作为开始状态。这个方法将不会做任何事情如果动画没有运行或者没有在动画块外调用。使用beginAnimations:context:类方法来开始并用commitAnimations类方法来结束动画块。默认值是NO。


setAnimationCurve:

设置动画块中的动画属性变化的曲线。+ (void)setAnimationCurve:(UIViewAnimationCurve)curve讨论动画曲线是动画运行过程中相对的速度。如果在动画块外调用这个方法将会无效。使用 beginAnimations:context:类方法来开始动画块并用commitAnimations来结束动画块。默认动画曲线的值是UIViewAnimationCurveEaseInOut。


setAnimationDelay:

在动画块中设置动画的延迟属性(以秒为单位)+ (void)setAnimationDelay:(NSTimeInterval)delay讨论这个方法在动画块外调用无效。使用beginAnimations:context: 类方法开始一个动画块并用commitAnimations类方法结束动画块。默认的动画延迟是0.0秒。


setAnimationDelegate:

设置动画消息的代理。+ (void)setAnimationDelegate:(id)delegate参数delegate你可以用setAnimationWillStartSelector:和setAnimationDidStopSelector: 方法来设置接收代理消息的对象。讨论这个方法在动画块外没有任何效果。使用beginAnimations:context:类方法开始一个动画块并用commitAnimations类方法结束一个动画块。默认值是nil


setAnimationDidStopSelector:

设置消息给动画代理当动画停止的时候。+ (void)setAnimationDidStopSelector:(SEL)selector参数selector当动画结束的时候发送给动画代理。默认值是NULL。这个选择者须有下面方法的签名:animationFinished:(NSString *)animationID finished:(BOOL)finished context:(void *)context。animationID一个应用程序提供的标识符。和传给beginAnimations:context: 相同的参数。这个参数可以为空。finished如果动画在停止前完成那返回YES;否则就是NO。context一个可选的应用程序内容提供者。和beginAnimations:context: 方法相同的参数。可以为空。讨论这个方法在动画块外没有任何效果。使用beginAnimations:context: 类方法来开始一个动画块并用commitAnimations类方法结束。默认值是NULL。


setAnimationDuration:

设置动画块中的动画持续时间(用秒)+ (void)setAnimationDuration:(NSTimeInterval)duration参数duration一段动画持续的时间。讨论这个方法在动画块外没有效果。使用beginAnimations:context: 类方法来开始一个动画块并用commitAnimations类方法来结束一个动画块。默认值是0.2。


setAnimationRepeatAutoreverses:

设置动画块中的动画效果是否自动重复播放。+ (void)setAnimationRepeatAutoreverses:(BOOL)repeatAutoreverses参数repeatAutoreverses如果动画自动重复就是YES否则就是NO。讨论自动重复是当动画向前播放结束後再重头开始播放。使用setAnimationRepeatCount: 类方法来指定动画自动重播的时间。如果重复数为0或者在动画块外那将没有任何效果。使用beginAnimations:context:类方法来开始一个动画块并用commitAnimations方法来结束一个动画块。默认值是NO。


setAnimationRepeatCount:

设置动画在动画模块中的重复次数+ (void)setAnimationRepeatCount:(float)repeatCount参数repeatCount动画重复的次数,这个值可以是分数。讨论这个属性在动画块外没有任何作用。使用beginAnimations:context:类方法来开始一个动画块并用commitAnimations类方法来结束。默认动画不循环。


setAnimationsEnabled:

设置是否激活动画+ (void)setAnimationsEnabled:(BOOL)enabled参数enabled如果是YES那就激活动画;否则就是NO讨论当动画参数没有被激活那么动画属性的改变将被忽略。默认动画是被激活的。


setAnimationStartDate:

设置在动画块内部动画属性改变的开始时间+ (void)setAnimationStartDate:(NSDate *)startTime参数startTime一个开始动画的时间讨论使用beginAnimations:context:类方法来开始一个动画块并用commitAnimations类方法来结束动画块。默认的开始时间值由CFAbsoluteTimeGetCurrent方法来返回。


setAnimationTransition:forView:cache:

在动画块中为视图设置过渡+ (void)setAnimationTransition:(UIViewAnimationTransition)transition forView:(UIView *)view cache:(BOOL)cache参数transition把一个过渡效果应用到视图中。可能的值定义在UIViewAnimationTransition中。view需要过渡的视图对象。cache如果是YES,那么在开始和结束图片视图渲染一次并在动画中创建帧;否则,视图将会在每一帧都渲染。例如缓存,你不需要在视图转变中不停的更新,你只需要等到转换完成再去更新视图。讨论如果你想要在转变过程中改变视图的外貌。举个例子,文件从一个视图到另一个视图,然後使用一个UIView子类的容器视图,如下:1.Begin an animation block.2.Set the transition on the container view.3.Remove the subview from the container view.4.Add the new subview to the container view.5.Commit the animation block.1.开始一个动画块。 2.在容器视图中设置转换。 3.在容器视图中移除子视图。 4.在容器视图中添加子视图。 5.结束动画块。


setAnimationWillStartSelector:

当动画开始时发送一条消息到动画代理+ (void)setAnimationWillStartSelector:(SEL)selector参数selector在动画开始前向动画代理发送消息。默认值是NULL。这个selector必须由和beginAnimations:context: 方法相同的参数,一个任选的程序标识和内容。这些参数都可以是nil。讨论这个方法在动画块外没有任何作用。使用beginAnimations:context:类方法来开始一个动画块并用commitAnimations类方法来结束。




升起代码:

[UIView beginAnimations:nil context:nil];
[UIView setAnimationCurve:UIViewAnimationCurveEaseInOut];
[UIView setAnimationDuration:0.6]; //使PickerView控件从底部升起动画
[m_pPickerView setFrame:CGRectMake(0.0, self.view.frame.size.height- m_pPickerView.frame.size.height, m_pPickerView.frame.size.width, m_pPickerView.frame.size.height)]; 
[UIView commitAnimations];

降下代码:

[UIView beginAnimations:nil context:nil];
//[UIView setAnimationCurve:UIViewAnimationCurveEaseInOut];
[UIView setAnimationCurve:UIViewAnimationCurveEaseOut];
[UIView setAnimationDuration:0.6];//使PickerView控件降下动画
[m_pPickerView setFrame:CGRectMake(0.0, self.view.frame.size.height, self.view.frame.size.width, 216.0)];
[UIView commitAnimations];

转帖:http://aifeng.59123.com/forum.php?mod=viewthread&tid=71

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics