Commit a636f63e by Daniel Dahan Committed by GitHub

Merge pull request #45 from OrkhanAlikhanov/status-bar

Fixed issue-44, view is hidden below status bar during call
parents 86f71232 3c48ac4d
Pod::Spec.new do |s| Pod::Spec.new do |s|
s.name = 'Motion' s.name = 'Motion'
s.version = '1.5.0' s.version = '1.5.0'
s.swift_version = '4.0' s.swift_version = '4.2'
s.license = 'MIT' s.license = 'MIT'
s.summary = 'A library used to create beautiful animations and transitions for Apple devices.' s.summary = 'A library used to create beautiful animations and transitions for Apple devices.'
s.homepage = 'http://cosmicmind.com' s.homepage = 'http://cosmicmind.com'
......
...@@ -143,5 +143,33 @@ extension MotionTransition { ...@@ -143,5 +143,33 @@ extension MotionTransition {
} }
tContext?.completeTransition(isFinishing) tContext?.completeTransition(isFinishing)
let isModalDismissal = isModalTransition && !isPresenting
if isModalDismissal {
UIApplication.shared.fixRootViewY()
}
}
}
private extension UIApplication {
/**
When in-call, hotspot, or recording status bar is enabled, just after (custom) modal
dismissal transition animation ends `UITransitionView` is removed from the hierarchy
and that removal was moving `rootViewController.view` 20 points upwards. This function
should be called after transitioningContext.completeTransition(_:) upon modal dismissal
transition. It applies the work that `UITransitionView` should ideally have done after
custom modal dismissal. `UIKit` modal dismissals do not suffer from this.
Fixes issue-44. See issue-44 for more info.
*/
func fixRootViewY() {
guard statusBarFrame.height == 40, let window = keyWindow, let vc = window.rootViewController else {
return
}
if vc.view.frame.maxY + 20 == window.frame.height {
vc.view.frame.origin.y += 20
}
} }
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment