如何设置 NIB 的动画,使其从右侧进入屏幕
我想这是非常基本的,但我想知道是否有一种简单的方法可以将整个 NIB 动画到屏幕上......来自右侧。理想情况下,我希望它在停止后弹起一点(即,如果 NIB 应该滚动到位置 X = 0,我想在返回到 0 之前将其稍微调为负值)。
这就是我到目前为止所拥有的:
[UIView animateWithDuration:0.5
delay:0
options:UIViewAnimationOptionCurveEaseIn
animations:^{
TabsEdit *tEdit = [[TabsEdit alloc] initWithNibName:@"TabsEdit" bundle:nil];
self.tabsEdit = tEdit;
[self.view addSubview:tEdit.view];
[tEdit release];
}
completion:^(BOOL finished){
}
是否有任何简单的解决方案,或者我是否需要将 NIB 中的每个元素设置为视图动画,然后添加我的小反弹效果?
对于如何有效实现这一目标的任何建议,我将不胜感激。
I guess this is quite basic, but I was wondering if there is an easy way to animate an entire NIB onto the screen... coming from the right. Ideally, I'd like it to bounce a bit once it stops (i.e. if the NIB is supposed to scroll to position X = 0, I'd like to go it slightly negative before coming back to 0).
This is what I have so far:
[UIView animateWithDuration:0.5
delay:0
options:UIViewAnimationOptionCurveEaseIn
animations:^{
TabsEdit *tEdit = [[TabsEdit alloc] initWithNibName:@"TabsEdit" bundle:nil];
self.tabsEdit = tEdit;
[self.view addSubview:tEdit.view];
[tEdit release];
}
completion:^(BOOL finished){
}
Is there any easy solution or will I need to animate every single element in the NIB into view and then add my little bounce effect to it?
I'd be grateful for any suggestions of how to achieve this efficiently.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
要获得更复杂的动画(如果您想要有更多的弹跳片段),您应该进入 CoreAnimation 层并定义关键帧。否则有一系列嵌入的 animateWithDuration/Completions,每个动画执行不同的反弹部分)。如果视图的所有元素都是子视图,那么当视图动画时,它的子视图也会跟随。
To get more complicated animations (if you want to have more segments to the bouce), you should go down to the CoreAnimation layer and define keyframes. Else have a series of embedded animateWithDuration/Completions, with each one doing a different part of the bounce). If all elements of a view are subviews, then when the view is animated, its subviews will follow.
重复一个动作即可弹跳。
one move repeat to bounce.