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

How to calculate the height. #10

Open
ratulSharker opened this issue Apr 10, 2020 · 3 comments
Open

How to calculate the height. #10

ratulSharker opened this issue Apr 10, 2020 · 3 comments
Assignees
Labels
Discussion Need to discuss. help wanted Extra attention is needed

Comments

@ratulSharker
Copy link
Owner

Currently the implementation height is given following

try RSPeekaboo.shared.peek(view: mLabel, height: CGFloat(50.0))

So there the height is 50.0. If compare with the youtube implementation, they keep very short height as of 25 for regular devices and much more larger for iPhoneX+ devices.

As per discussion with @ab1d-rahman he enlighten me about

UIApplication.shared.keyWindow?.safeAreaInsets.bottom

is the value what we are looking for. It denotes the bottom height what we should ignore. While playing with it i found that it is available from iOS 11.0+.

So there is few questions

  1. Should we handle the extra height needed to pad for iPhonex+ devices ?
  2. If we should handle the padding, how are we going to get the padding value in iOS 10.x.x.
@ratulSharker ratulSharker added Discussion Need to discuss. help wanted Extra attention is needed labels Apr 10, 2020
@ab1d-rahman
Copy link
Collaborator

ab1d-rahman commented Apr 11, 2020

I think it's better we let the user deal with height calculation. That will provide the user with more freedom. Adding safe area related calculations might create confusion/complexity for the user.

@ratulSharker
Copy link
Owner Author

I think it's better we let the user deal with height calculation. That will provide the user with more freedom. Adding safe area related calculations might create confusion/complexity for the user.

Then pod user have to calculate the extra padding needed to iPhoneX+ devices. So user have to add UIApplication.shared.keyWindow?.safeAreaInsets.bottom to original height. But the problem is UIApplication.shared.keyWindow?.safeAreaInsets.bottom is available only iOS 11.0+ . For iOS 10.0 how can we calculate this value ?

@ab1d-rahman
Copy link
Collaborator

For any device which has iOS 10 or older, you can be sure they do not need to calculate the extra padding height. Only devices that have safe area related calculations are all iPhonesX+ and you will never find any of these devices running on iOS 10 or older.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Discussion Need to discuss. help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

3 participants