【发布时间】:2014-12-10 07:01:56
【问题描述】:
我在导航栏上有一个 UIButton 作为右栏按钮项。 我想在单击 UIButton 时显示一个视图, 并且该视图应该从右到左显示动画并停止为用户执行一些操作。 当用户完成视图上的工作时,他将单击相同的按钮,视图将从右到左隐藏动画。
我尝试正常加载视图我成功了, 当我应用动画时 视图从右到左动画并消失。 我是这个动画场景的新手。 所以任何人都可以指导我动画视图并在同一个按钮上显示隐藏操作。
这是我尝试过的代码,
-(IBAction)showView :(id)sender
{
CGRect screen = [[UIScreen mainScreen]applicationFrame];
UIView *quizInfoViewObj;
quizInfoViewObj = [[UIView alloc]init];
quizInfoViewObj.frame = CGRectMake(70, 0, 250, 480);
quizInfoViewObj.backgroundColor = [UIColor orangeColor];
[UIView beginAnimations: nil context: NULL];
[UIView setAnimationDelegate: self];
[UIView setAnimationDidStopSelector: @selector(pushAnimationDidStop:finished:context:)];
quizInfoViewObj.center = self.view.center;
quizInfoViewObj.center = CGPointMake(self.view.center.x - CGRectGetWidth(self.view.frame), self.view.center.y);
[UIView commitAnimations];
[self.view addSubview:quizInfoViewObj];
}
这里是我想要的...
【问题讨论】:
标签: ios xcode uiviewanimation