大佬教程收集整理的这篇文章主要介绍了iphone – 实现自定义动画呈现模式视图从指定的视图在iPad上,大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。
我知道如何在新formSheet中呈现模态视图,并且可以在这个问题上找到一个接近的方法:iPad iTunes Animation
问题是,你不能选择动画来自哪里,所以它只是默认和出现在中心,我想自定义它,使它出现从一个特定的位置。
我可以找到这个动画的最好的例子可以看到在this video的前几秒钟
如果任何人可以指向我正确的方向使用代码,教程或文档,我会非常感谢它!
更新:
经过一番调查,我发现这可以使用层和核心动画的第一部分;然后动画一个formSheet模态视图,但我还是不太明白如何实现它,希望你们可以帮助!
UIViewController ShowModalFromView.h
#import <Foundation/Foundation.h> #import <QuartzCore/QuartzCore.h> @interface UIViewController (ShowModalFromView) - (void)presentModalViewController:(UIViewController *)modalViewController fromView:(UIView *)view; @end
UIViewController ShowModalFromView.m
#import "UIViewController+ShowModalFromView.h" @implementation UIViewController (ShowModalFromView) - (void)presentModalViewController:(UIViewController *)modalViewController fromView:(UIView *)view { modalViewController.modalPresentationStyle = UIModalPresentationFormSheet; // Add the modal viewController but don't animate it. We will handle the animation manually [self presentModalViewController:modalViewController animated:NO]; // Remove the shadow. It causes weird artifacts while animaTing the view. CGColorRef originalShadowColor = modalViewController.view.superview.layer.shadowColor; modalViewController.view.superview.layer.shadowColor = [[UIColor clearColor] CGColor]; // Save the original size of the viewController's view CGRect originalFrame = modalViewController.view.superview.frame; // Set the frame to the one of the view we want to animate from modalViewController.view.superview.frame = view.frame; // Begin animation [UIView animateWithDuration:1.0f animations:^{ // Set the original frame BACk modalViewController.view.superview.frame = originalFrame; } completion:^(BOOL finished) { // Set the original shadow color BACk after the animation has finished modalViewController.view.superview.layer.shadowColor = originalShadowColor; }]; } @end
这是很直接。请让我知道如果这有助于你。
更新
我更新了答案使用动画块,而不是[UIView beginAnimations:nil context:nil]; / [UIView commitAnimations]对。
以上是大佬教程为你收集整理的iphone – 实现自定义动画呈现模式视图从指定的视图在iPad上全部内容,希望文章能够帮你解决iphone – 实现自定义动画呈现模式视图从指定的视图在iPad上所遇到的程序开发问题。
如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。
本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。