Skip to content

Not working when initiated in landscape. #23

@mark-dlc

Description

@mark-dlc

First of all, great project, thanks for open sourcing it!

Currently, when _topViewDefaultY is set in setTopView it is assumed that this method is called in portrait. This value is then adjusted in topViewDefaultY for landscape when the device is rotated.

However, it has not been accounted for that JDFPeekaboo can be initiated in landscape, breaking the layout. It doesn't matter whether you stay in landscape or rotate to portrait, If you init in landscape, the layout will always break.

I've worked around this by replacing:
self.topViewDefaultY = topBar.frame.origin.y;
with
self.topViewDefaultY = 20.0f; in setTopView.
But this isn't an ideal solution, because the status bar height is hardcoded. And there is to my knowledge, no way to predict the status bar height for portrait when in landscape (I.e. this doesn't when the status bar isn't 20.0f exactly like on the iPhone X)

I've also tried adding:

if (_topViewDefaultY == 0.0f){
       _topViewDefaultY += [[UIApplication sharedApplication] statusBarFrame].size.height;
}

And this does resolve the issue when initing in landscape and then rotating to portrait. But it doesn't work when staying in landscape.

Request: Add support for initing JDFPeekABoo in landscape. Please test with the iPhone X as well.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions