Hero: No transparent view in precent VC

Created on 15 Mar 2017  路  8Comments  路  Source: HeroTransitions/Hero

Following is my code, second view transparent is only worked with Hero default animation (fade in). If I used other animation, alpha become 1 I think.

Btw, how to set same effect on dismiss also?
I used default code dismiss(animation, completion)
but only fade out effect worked.

Thanks for this Hero library.

vc.modalPresentationStyle = .overFullScreen
vc.isHeroEnabled = true
vc.heroModalAnimationType = .pageIn(direction: .down)
self.present(vc, animated: true, completion: nil)
reopen if needed

Most helpful comment

Why is it closed, it's still happening.

All 8 comments

Try 0.3.4 and see if it fixes it.

For your second question:

heroModalAnimationType = .selectBy(presenting: .pageIn(direction: .down), dismissing: .pageOut(direction: .down))

@lkzhao Seems it still not working with 0.3.6 version. Thanks for the Hero.

vc.heroModalAnimationType = .zoom
vc.modalPresentationStyle = .currentContext
vc.view.backgroundColor = UIColor.clear

fromVC.present(vc, animated: true) {
            //...
}

But this code works if

vc.heroModalAnimationType = .fade

Hey, I have the exact same problem. How to fix? .overCurrentContext is not working with .zoom but works with .fade

Why is it closed, it's still happening.

@lkzhao Is there something to do to avoid black background while presenting view controller over current context ? As @MaeseppTarvo & @EquaI1ty explained, only .fade transition works :/

targetVC.modalPresentationStyle = .overCurrentContext
targetVC.view.backgroundColor = .clear
targetVC.modalPresentationCapturesStatusBarAppearance = true

works with present but if you use push it is still black for transparent areas

@ergunkocak Thank you!!!!! Setting the presented controller's background to .clear before viewDidLoad() (either right before present(), or inside init() in presented VC) and also .modalPresentationStyle to .overCurrentContext finally got rid of the ending black background for me.

I am facing this issue in .overCurrentContext presentation style in iOS 13.3 using heroModalAnimationType .fade animation.

Was this page helpful?
0 / 5 - 0 ratings