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 can I do the same as the guys of Tripnary? #143

Open
felipecaldas opened this issue Jul 15, 2016 · 4 comments
Open

How can I do the same as the guys of Tripnary? #143

felipecaldas opened this issue Jul 15, 2016 · 4 comments

Comments

@felipecaldas
Copy link

Hey all,

Trying to do pretty much the same what the guys at Tripnary did.

My background has the iPhone frame and the ContentView will have the text and image that gets swiped. I need to have the title at the very top of the screen, then the body label after it and lastly, the image. I'd think the image is the icon...

How do I invert those three?

Thanks.

@felipecaldas
Copy link
Author

For an iPhone 5s, I did this:

firstPage.topPadding = 200;
        firstPage.underIconPadding = -530;
        firstPage.underTitlePadding = 5;
        firstPage.iconWidth = 230
        firstPage.iconHeight = 360

And it worked great. But obviously this hardcoded code won't work for all devices. I tested with 6 Plus and it didnt work.
Any suggestion, guys? Thanks

@sagaya
Copy link

sagaya commented Oct 24, 2016

I have the same trouble please help

@jackngai
Copy link

jackngai commented Apr 5, 2017

I guess the long way to do this is to use UIDevice to get the device type and use a switch statement to handle the different sizes (4", 4.7" and 5.5")?

@jackngai
Copy link

jackngai commented Apr 5, 2017

I end up using a switch statement on UIScreen.main.bounds.height to support the 3 screen sizes I listed. Here's the code:

    switch UIScreen.main.bounds.height{
    case 667.0:
        topPadding = 267
        underIconPadding = -580
        underTitlePadding = 5
        iconWidth = 298
        iconHeight = 375
    case 736.0:
        topPadding = 295
        underIconPadding = -620
        underTitlePadding = 5
        iconWidth = 324
        iconHeight = 404
    default:
        topPadding = 228
        underIconPadding = -500
        underTitlePadding = 5
        iconWidth = 252
        iconHeight = 310
    }

667 is for 4.7" and 736 is for 5.5". Your values will probably not match mines exactly but this worked for me.

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

3 participants