Transitioning between VC's during a call or when the phone is used as hotspot messes up their positions (frames get shifted upwards by 20 every transition)
This problem can be reproduced by enabling the status bar in the 'HeroExamples' applications, and perform some transitions.
Kind of a corner case scenario, but would still be nice if you can take a look at it!
Just found out that setting:
modalPresentationStyle = .custom
modalPresentationCapturesStatusBarAppearance = true
in the presented VC kind of fixes the problem. The frame jumps back to the correct position after the transition is finished, which still looks a bit weird because the frame is just set without animation
Hmm, will double check this. thanks for reporting.
@LcTwisk @lkzhao is there a workaround for that in navigationControllers ?
Any possible workaround for this? I've tried @LcTwisk solution but it doesn't work either that way for me :(, The frame does not jumps back to the correct position after the transition is finished 馃憥
@baims @ed-mejia
I wrote a extension of UIApplication:
extension UIApplication {
func resetKeyViewPosition() {
if statusBarFrame.height == 40 {
if let window = keyWindow, let vc = window.rootViewController {
let frame = vc.view.frame
if frame.height + frame.minY + 20 == window.frame.height {
vc.view.frame = CGRect(x: frame.minX, y: frame.minY + 20, width: frame.width, height: frame.height)
}
}
}
}
}
Call UIApplication.shared.resetKeyViewPosition() after the transition was ended.
It did work for me. But I hope I can avoid these codes.
And thanks for @lkzhao 's working. Hero is a very powerful tool.
Had the answer solved your issue?
Most helpful comment
Hmm, will double check this. thanks for reporting.