jcoleman / JCNotificationBannerPresenter

A library for generic presentation of "banners" (e.g. to present a push notification) from anywhere inside an iOS app.
MIT License
198 stars 46 forks source link

Banners Off-Screen if No Status Bar #26

Open apiech opened 9 years ago

apiech commented 9 years ago

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); }

jcoleman commented 9 years ago

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.

apiech commented 9 years ago

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 notifications@github.com 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 .

benjaminhallock commented 9 years ago

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

It is halfway off the screen.

mnill commented 9 years ago

Issue is still there :-(

jcoleman commented 9 years ago

@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.

mnill commented 9 years ago

@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.

sridharrajagopal commented 7 years ago

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