ale*_*ine 6 iphone animation uiview
我有一个叫做geopointView的UIView.我想在按下按钮(myButton)时在主视图框架上为此UIview中的幻灯片设置动画.如果再次按下myButton,UIview应该滑出框架.myButton调用以下方法"optionsCalled"
-(void) optionsCalled
{
if (![[self.view subviews] containsObject:geopointView] &&checkForGeopointViewAnimation ==0) {
[self.view addSubview:geopointView];
geopointView.frame = CGRectMake(0,430,320,30);
[UIView animateWithDuration:0.3f
animations:^{
geopointView.frame = CGRectMake(0, 350, 100, 80);
}
completion:^(BOOL finished){
checkForGeopointViewAnimation = 1 ;
}];
}
if ([[self.view subviews] containsObject:geopointView] && checkForGeopointViewAnimation ==1)
{
geopointView.frame = CGRectMake(0, 350, 100, 80);
[UIView animateWithDuration:0.3f
animations:^{
geopointView.frame = CGRectMake(0,430,320,30);
}
completion:^(BOOL finished){
checkForGeopointViewAnimation = 0 ;
}];
[geopointView removeFromSuperview];
}
}
Run Code Online (Sandbox Code Playgroud)
这里checkForGeopointViewAnimation是一个全局变量,定义为确保一次不调用滑入和滑出.
此代码的问题在于UIview以动画方式滑动,但它不会为幻灯片操作设置动画.它只是从主框架消失.我是否需要在这里使用任何时间,以便延迟调用添加和删除UIview功能?
在此先感谢您的帮助
| 归档时间: |
|
| 查看次数: |
1899 次 |
| 最近记录: |