推动没有阴影和停电的动画 [英] Push animation without shadows and blackouts

查看:178
本文介绍了推动没有阴影和停电的动画的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个简单的 iOS NavigationController 为基础的应用程序。两个 UICollectionViews ,一个接一个。如果点击了第一个集合上的元素,则会打开第二个集合
非常简单。

I have a simple iOS NavigationController based application. Two UICollectionViews, one after another. If element on "first collection" was clicked, the "second collection" will be opened. Quite simple.

重要说明:

两个 UICollectionViews 都有透明背景。使用了 navigationController 的常规背景颜色。(来自<$的继承类c $ c> UINavigationController )

"Both UICollectionViews have transparent background. General background color for navigationController is used. (Inherited class from UINavigationController)"

问题:
如果理解正确, NavigationController 的推送方法根据算法工作:

The problem: If understood it right, push method of NavigationController works according to algorithm:


  1. 推送视图已创建。

  2. 透明灰色叠加已创建超过推送视图。

  3. NavigationController使用标准动画推送视图。 (灰色叠加仍然存在)

  4. 灰色叠加层消失。

  1. Pushing view is created.
  2. Transparent gray overlay is created over pushing view.
  3. NavigationController pushes the view with standard animation. (Gray overlay still there)
  4. Gray overlay disappears.

(如果推视图具有透明背景,则可以看到灰色垂直线

屏幕截图

Screenshot

下一步:
我试图通过重写push方法来解决这个问题。这就是我所拥有的:

Next step: I've tried to solve this problem by overriding push method. Here's what I've got:

- (void)pushViewController:(UIViewController *)viewController 
                           animated:(BOOL)animated
{
    CATransition *transition = [CATransition animation];
    transition.duration = 0.45;
    transition.timingFunction = [CAMediaTimingFunction 
           functionWithName:kCAMediaTimingFunctionEaseInEaseOut];
    transition.type = kCATransitionPush;
    transition.subtype = kCATransitionFromRight;
    transition.fillMode = kCAFillModeForwards;
    transition.delegate = self;
    [self.view.layer addAnimation:transition forKey:nil];

    [super pushViewController:viewController animated:animated];
}

这种方式可以创建自己的推送动画,但还有其他标准动画,我无法删除。 (显示和隐藏视图时停电)

This way creates its own push animation, but there were another standard animations used, which I can't remove. (Blackout on presenting and hiding views)

Screenshots_1_and_2

Screenshots_1_and_2

问题:
如何推送ViewController,不使用淡入淡出,停电和其他动画过滤器?

带主题名称的解决方案(在<上strong> stackoverflow.com )

Solutions with theme names (on stackoverflow.com)


  • iOS 7 UINavigationController 推动画shadow

  • iOS 7在导航的自定义动画中显示黑色背景

  • iOS 7 UINavigationController Push animation shadow
  • iOS 7 shows black background in custom animation for Navigation

不起作用。

推荐答案

不要覆盖push方法。 iOS7允许您为自定义过渡提供动画控制器。有关详细信息,请参见此处

Don't override the push method. iOS7 allows you to provide animation controllers for custom transitions. See here for more details.

这篇关于推动没有阴影和停电的动画的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆