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

Bottom Positioning #10

Open
khashabri opened this issue Sep 27, 2020 · 2 comments
Open

Bottom Positioning #10

khashabri opened this issue Sep 27, 2020 · 2 comments

Comments

@khashabri
Copy link

Not sure why we use the number of 80 here, but does anyone know how to position the card exactly above the tabBar when it is at the bottom position? (of course screen size independent)

return UIScreen.main.bounds.height - 80

Like this
Bildschirmfoto 2020-09-27 um 15 27 44

@moifort
Copy link
Owner

moifort commented Sep 28, 2020

Sorry for the late answer I wasn't notified , I will take a look!

@khashabri
Copy link
Author

Alright. I couldn't find a programmatically solution to stop the card right above the tabBar (here also my forum post). So, I ended up writing the following function:

func aboveTabBarPosition(screenSize: CGRect) -> CGFloat{
    switch screenSize {
    case CGRect(x: 0.0, y: 0.0, width: 375.0, height: 667.0): // iPhone 8 & iPhone SE
        return 485
    case CGRect(x: 0.0, y: 0.0, width: 414.0, height: 736.0): // iPhone 8 Plus
        return 551
    case CGRect(x: 0.0, y: 0.0, width: 414.0, height: 896.0): // iPhone 11
        return 650
    case CGRect(x: 0.0, y: 0.0, width: 375.0, height: 812.0): // iPhone 11 Pro
        return 569
    case CGRect(x: 0.0, y: 0.0, width: 414.0, height: 896.0): // iPhone 11 Pro Max
        return 654
    case CGRect(x: 0.0, y: 0.0, width: 320.0, height: 568.0): // iPod touch
        return 390
    default:
        return screenSize.height/1.425
    }
}

and changing the line

return UIScreen.main.bounds.height - 80

to
return aboveTabBarPosition(screenSize: UIScreen.main.bounds)

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

2 participants