JDFPeekaboo icon indicating copy to clipboard operation
JDFPeekaboo copied to clipboard

Not working when initiated in landscape.

Open mark-dlc opened this issue 7 years ago • 1 comments

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.

mark-dlc avatar Dec 16 '17 15:12 mark-dlc

Hi @mark-dlc - thanks!

Apologies for the slow reply. Busy time of year...

Thanks for reporting this. It definitely needs looking at. I’m pretty busy at the moment, but I’ll certainly get to it when I can (or feel free to submit a PR if you’re able to).

JoeFryer avatar Dec 20 '17 16:12 JoeFryer