我正在尝试制作动画。当我单击图像时,视图会将UIViewController
从navigationController
的视图扩展到整个屏幕的边界,然后将其推到// Code in the controller which pushes the controller on the stack
self.navigationController.view.center = center;
self.navigationController.view.frame = frame;
self.navigationController.view.transform = CGAffineTransformMakeScale(0.1f, 0.1f);
// Code in the viewDidAppear of controller being pushed to the stack
[UIView animateWithDuration:0.5
delay:0.0
options:UIViewAnimationOptionCurveEaseOut
animations:^{
self.navigationController.view.transform = CGAffineTransformIdentity;
self.navigationController.view.frame = [[UIScreen mainScreen] bounds];
self.navigationController.view.center = CGPointMake(self.view.frame.size.width/2, self.view.frame.size.height/2);
}
completion:nil];
上并缩小到相同的大小,同时将其弹回。我能够创建推送动画,但在尝试创建弹出动画时失败了。
viewDidDisappear
这项工作正常,但我在initialFrame
中尝试使用以下代码进行流行动画,其中UIViewController
是我点击以打开// Code for viewDidDisappear
[UIView animateWithDuration:0.5
delay:0.0
options:UIViewAnimationOptionCurveEaseOut
animations:^{
self.view.transform = CGAffineTransformMakeScale(0.1f, 0.1f);
self.view.frame = self.initialFrame;
self.view.center = CGPointMake(self.initialFrame.size.width/2 + self.initialFrame.origin.x, self.initialFrame.size.height/2 + self.initialFrame.origin.y);}
completion:nil];
的框架。
function add() {
// just in case someone will try to run the function without arguments
if (!arguments.length) {
throw new Error("add(): Function call with no arguments.");
}
// final return
if (arguments.length === 1) {
return arguments[0];
}
// removing first element from array and saving it in variable 'number'
// we use Array.prototype.shift.apply() because 'arguments' is an array-like
// object, and doesn't have shift() method
var number = Array.prototype.shift.apply(arguments);
// this is a bit hacky, adding number to the first element of 'arguments'
arguments[0] += number;
// recursively calling function with new arguments
return add.apply(this, arguments);
}
add(1, 2, 3, 4, 5);
我无法使pop动画生效。请帮帮我。