use*_*015 11 iphone uiview ipad uiviewanimationtransition ios
主UIView包含两个子视图 - UIView_1和UIView_2.
在UIView_2,有一个按钮来显示或隐藏UIView_1.
例如,当用户触摸所述按钮显示UIView_1,然后UIView_1将向下滑动,并UIView_2将与过渡向下推.
我对动画知之甚少.有人可以给我看一些示例代码供参考吗?
我应该使用CGAffineTransformMakeTranslation吗?
谢谢.
Sha*_*rog 20
你不需要那么复杂的东西.只需更改视图的帧大小即可.
NSTimeInterval animationDuration = /* determine length of animation */;
CGRect newFrameSize = /* determine what the frame size should be */;
[UIView beginAnimations:nil context:NULL];
[UIView setAnimationDuration:animationDuration];
theViewToChange.frame = newFrameSize;
[UIView commitAnimations];
Run Code Online (Sandbox Code Playgroud)
简单地隐藏/显示fadein/out效果`
/ 显示 /
sliderView.hidden = NO;
sliderView.alpha = 0.1;
[UIView animateWithDuration:0.25 animations:^{
sliderView.alpha = 1.0f;
} completion:^(BOOL finished) {
// do some
}];
Run Code Online (Sandbox Code Playgroud)
/ 隐藏 /
[UIView animateWithDuration:0.25 animations:^{
sliderView.frame = CGRectMake(130, 30, 0, 0);
[sliderView setAlpha:0.1f];
} completion:^(BOOL finished) {
sliderView.hidden = YES;
}];
Run Code Online (Sandbox Code Playgroud)
`
| 归档时间: |
|
| 查看次数: |
22167 次 |
| 最近记录: |