我想知道在Ipad的Music文件夹中使用的功能的名称是什么,当单击相册文件夹时,有关该相册的详细信息会弹出动画视图。类似于Ipad音乐文件夹中的一个的动画弹出视图
我试过使用presentModelViewController,但它的功能是不同的。
如果有人能帮助我,那将会很棒。
我想知道在Ipad的Music文件夹中使用的功能的名称是什么,当单击相册文件夹时,有关该相册的详细信息会弹出动画视图。类似于Ipad音乐文件夹中的一个的动画弹出视图
我试过使用presentModelViewController,但它的功能是不同的。
如果有人能帮助我,那将会很棒。
我只是设法得到某事。像这样使用CoreAnimation/QuartzCore框架的工作...... 一定要
#import <QuartzCore/QuartzCore.h>
时要进行动画
,使用CATransform3Dand的不良记录CATransform3D.m34财产。这会做动画(假设200×200 < - > 450x450 180°旋转)的上半年:
[UIView beginAnimations:nil context:NULL];
[UIView setAnimationDuration:0.5];
[UIView setAnimationCurve:UIViewAnimationCurveEaseIn];
[UIView setAnimationDelegate:self];
CATransform3D rotationAndPerspectiveTransform = CATransform3DIdentity;
rotationAndPerspectiveTransform.m34 = 1.0/-1000; // this turns on perspective!
rotationAndPerspectiveTransform = CATransform3DRotate(rotationAndPerspectiveTransform, 90.0f * M_PI/180.0f, 0.0f, 1.0f, 0.0f);
someView.layer.transform = rotationAndPerspectiveTransform;
someView.bounds = CGRectMake(0, 0, 325, 325);
[UIView commitAnimations];
为动画的下半年,你必须添加/删除您的视图层次结构。此实施例表明,已经存在作为一个子视图的视图的隐藏/显示,这也使得使用BOOL isUp
实例变量(该aniation的前半部分是独立于ISUP-标志!)
- (void)animationDidStop:(CAAnimation *)anim finished:(BOOL)flag
{
if (flag) {
if (isUp) {
someSubView.hidden = YES; // hide subview
[UIView beginAnimations:nil context:NULL];
[UIView setAnimationDuration:0.5];
[UIView setAnimationCurve:UIViewAnimationCurveEaseOut];
CATransform3D rotationAndPerspectiveTransform = CATransform3DRotate(someView.layer.transform, -90.0f * M_PI/180.0f, 0.0f, 1.0f, 0.0f);
someView.layer.transform = rotationAndPerspectiveTransform;
someView.bounds = CGRectMake(0, 0, 200, 200);
[UIView commitAnimations];
isUp = NO;
} else {
someSubView.hidden = NO; // Show subview
[UIView beginAnimations:nil context:NULL];
[UIView setAnimationDuration:0.5];
[UIView setAnimationCurve:UIViewAnimationCurveEaseOut];
CATransform3D rotationAndPerspectiveTransform = CATransform3DRotate(someView.layer.transform, 90.0f * M_PI/180.0f, 0.0f, 1.0f, 0.0f);
someView.layer.transform = rotationAndPerspectiveTransform;
someView.bounds = CGRectMake(0, 0, 450, 450);
[UIView commitAnimations];
isUp = YES;
}
}
}
最后一两件事:一切都在你看来会出现镜像,它可能不是理想的解决方案,而是通过应用CGAffineTransform
到子视图镜像回来的伎俩:用这么晚
- (void)viewDidLoad
{
[super viewDidLoad];
someSubView.transform = CGAffineTransformMakeScale(-1, 1);
isUp = NO;
}
我是alredy一个月解决方案,但我希望它可以帮助某人:)
我第一次尝试使用animateWithDuration:animations:completion:基于块的API,但是事实证明这种API很严重(即使没有触及子视图,也没有平滑的第一/第二半animaiton)。
在iPad上,您可以通过几种不同的方式来设置模态视图控制器的动画,您可以在这里找到它们:UIModalTransitionStyle。但是,如果您提到专辑中的“缩放和翻转”效果,我很肯定这是私人行为,所以您需要自己开发这个......您可能能够完成这与核心图形/石英。
@ Jamie ..谢谢你的回复..我已经尝试了各种风格,没有一个满足我的要求......我认为这是我正在寻找的“缩放和翻转效果”这个词..因为我会更容易向其他人解释我想要什么样的效果...... – learner2010 2011-04-13 19:08:23
谢谢你的答案..我尝试了你的代码,但它对我没有任何影响..你能向我解释什么someView,someSubView和greenView是?我认为someView会是我的[self.view],我的someSubView将是我的子视图..但什么是greenView? – learner2010 2011-06-16 18:07:56
当我将“前半部分”的动画代码应用到我的[self.view]中时,它给出的效果是一个内爆效果。是它是什么? – learner2010 2011-06-16 18:09:18
sry greenView是我用于这篇文章的示例代码的遗骸。你可以看看我的这个动画的测试项目 - 只是上传:) [http://cl.ly/3y0c280W1Z1t3G2R0h43](http://cl.ly/3y0c280W1Z1t3G2R0h43) – 2011-06-16 19:36:13