简体   繁体   English

iOS:如何用动画效果打开相机?

[英]iOS:How to open camera with animation effect?

I want to open camera with animation effect, so that it should appear that camera is opening in the parent screen only. 我想打开带有动画效果的相机,这样才能看出相机只在父屏幕上打开。 I am using camera overlay screen and on click event of button in parent screen,camera overlay screen is opening,in camera overlay screen there is a cancel button to close the camera,so while closing the camera again I need to show the animation effect that it should appear that now camera is closed in the same parent scree. 我正在使用相机覆盖屏幕和父屏幕上的按钮点击事件,相机覆盖屏幕正在打开,在相机覆盖屏幕中有一个取消按钮关闭相机,所以当再次关闭相机时,我需要显示动画效果,看来现在相机在同一个父母碎片中关闭了。 I have tried kCATransitionMoveIn but not fully satisfied,if any once has better solution please help me. 我已经尝试了kCATransitionMoveIn但不完全满意,如果有任何一次有更好的解决方案请帮助我。

CATransition * contentAnimation = [CATransition animation];
    contentAnimation.type = kCATransitionMoveIn;
    contentAnimation.subtype = kCATransitionFromBottom;
    contentAnimation.duration = 1.0;
    contentAnimation.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseOut];
    [[self.view layer] addAnimation:contentAnimation forKey:kCATransition];
    //self.view.hidden = YES;
    [CATransaction commit];
    // Show the scanner overlay
    [self presentModalViewController:overlayController.parentPicker animated:TRUE];

This could be somewhat tidious but try out downloading ZBar SDK which is .dmg file. 这可能有些琐碎,但尝试下载ZBar SDK即.dmg文件。 and double click it. 然后双击它。 You will find Examples Folder. 你会发现Examples Folder。 In that you will find 4 apps. 在那你会找到4个应用程序。 Try out that app in Device only. 在设备中试用该应用。 You will find amazing CAMERA open with animation effect. 你会发现惊人的CAMERA打开动画效果。

我已经解决了这个问题,我已经将ZBar SDK示例作为参考,这个link1link2也帮助了我。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM