Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Message Over the Status Bar #221

Open
tomasbek opened this issue Sep 6, 2018 · 7 comments
Open

Message Over the Status Bar #221

tomasbek opened this issue Sep 6, 2018 · 7 comments

Comments

@tomasbek
Copy link

tomasbek commented Sep 6, 2018

Hello,

I need to show a message over the status bar. However, the message covers navigation button on the iPhone X as you can see in this screenshot:
simulator screen shot - iphone x - 2018-09-06 at 23 07 02
The configuration I use is as follows:

    warningConfig.presentationContext = .window(windowLevel: UIWindowLevelStatusBar)

What could be done to avoid this problem?

Thank you very much!

@wtmoose
Copy link
Member

wtmoose commented Sep 6, 2018

Why not reduce the height of the message?

@tomasbek
Copy link
Author

tomasbek commented Sep 6, 2018

The size is fine for all models except for X. I guess that the message is 'higher' on the X due to the notch. Please take a look at the image below:
untitled
Is it possible to remove that empty space between the bottom of the notch and the top of the text?

@wtmoose
Copy link
Member

wtmoose commented Sep 6, 2018

SwiftMessages layouts don't put content in safe areas. You can adjust messageView.layoutMarginAdditions.top on a per-device basis if the default layout don't work for you.

@tomasbek
Copy link
Author

tomasbek commented Sep 7, 2018

@wtmoose, thank you very much for your suggestion. I have added this line of the code to solve the problem for the iPhone X:

messageView.layoutMarginAdditions.top = -15

For all the other models I set the top margin to 0.

Thanks again for your guidance!

@wtmoose
Copy link
Member

wtmoose commented Sep 7, 2018

Glad it worked.

In SwiftMessages 4, the layout you're using (it looks like .statusLine) did not cover the navigation bar. However, I made a global change in SwiftMessages 5 to keep content out of the safe area based on feedback from one of my designers. But after thinking about it more, this layout seems like a good case to break that rule and allow the label into the safe area. So I may revert back to the old behavior in a future update. I'll keep this ticket open for now.

@yunustek
Copy link

yunustek commented Sep 22, 2019

Hi Everybody, I solved the problem 👍
When you add the extension you can solve the problem:
The extension function solved when you open in any view controller. The code will open with the view controller prefersStatusBarHidden.

import SwiftMessages

extension WindowViewController {
	open override var prefersStatusBarHidden: Bool {
		return UIApplication.shared.topMostViewController()?.prefersStatusBarHidden ?? false
	}
}

@grifas
Copy link

grifas commented Jan 7, 2020

Hi, I have the same issue. I used what you adviced:

SwiftMessages layouts don't put content in safe areas. You can adjust messageView.layoutMarginAdditions.top on a per-device basis if the default layout don't work for you.

That works fine but now my issue is that it's hard to tap on it to trigger the buttonTapHandler.

Any solution ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants