JCNotificationBannerPresenter icon indicating copy to clipboard operation
JCNotificationBannerPresenter copied to clipboard

Banners Off-Screen if No Status Bar

Open apiech opened this issue 10 years ago • 7 comments

my app has the status bar hidden so (on iOS8 and possibly other versions), [[UIApplication sharedApplication] statusBarFrame].size returns (0, 0). This is causing JCNotificationPresenters to put the banner half off screen.

I don't have the time right now to fully understand this entire library to know if my change is good but for my purposes this is a quick-fix: CGSize statusBarSize = [[UIApplication sharedApplication] statusBarFrame].size; // AP: if the status bar is hidden it has size 0, so pretend it's the width of the display window if(statusBarSize.width < 1) { statusBarSize = CGSizeMake(window.bounds.size.width, statusBarSize.height); }

apiech avatar Dec 09 '14 22:12 apiech

Have you tested this in both portrait and landscape orientations?

Also, please open a pull request with the fix. I'd like to see it use comparison to CGSizeZero as well.

jcoleman avatar Dec 09 '14 22:12 jcoleman

tested in portrait and landscape, seems good to me. I don't know if I like CGSizeZero because it's really the width that is causing the offscreen positioning. I doubt there will be status bars with zero width and non-zero height though, so either way should be fine?

left some comments on the pull request with alternative ideas, I've only looked at your project for 30 minutes so I don't know why things are how they are

I pretty much created my github account to do this so let me know if I messed it up :) pretty complicated process but a simple enough change to get my feet wet.

thanks!

On Tue, Dec 9, 2014 at 2:36 PM, James Coleman [email protected] wrote:

Have you tested this in both portrait and landscape orientations?

Also, please open a pull request with the fix. I'd like to see it use comparison to CGSizeZero as well.

— Reply to this email directly or view it on GitHub https://github.com/jcoleman/JCNotificationBannerPresenter/issues/26#issuecomment-66371555 .

apiech avatar Dec 09 '14 23:12 apiech

CONFIRM: I have an AVCaptureSession with navigationbar && statusbar hidden.

It is halfway off the screen.

benjaminhallock avatar Feb 17 '15 19:02 benjaminhallock

Issue is still there :-(

mnill avatar Jun 17 '15 12:06 mnill

@mnill Can you confirm that the suggested patch works? I'm actually about to finally transition back into iOS projects, so I'll be looking at this soon.

jcoleman avatar Jun 17 '15 12:06 jcoleman

@jcoleman I'm use this pull request https://github.com/jcoleman/JCNotificationBannerPresenter/pull/20 And it is works correctly. I'm use your library as dependency on my work and will make more tests in near future.

mnill avatar Jun 17 '15 12:06 mnill

I've tried out mnill's fix too, and it works! It would be great if you could pull the changes in, and update the pod.

Thanks for your work - it's really awesome! :-)

-Sridhar

sridharrajagopal avatar Jan 02 '17 16:01 sridharrajagopal