jcoleman / JCNotificationBannerPresenter

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

Status bar hidden issue: fix included #19

Closed Genhain closed 10 years ago

Genhain commented 10 years ago

Just mostly too bring this to your attention, as i have never uploaded a fix to someone else's branch before. so i will just post it here.

The presenter is off screen if you have the status bar hidden throughout your app by default as you do the x position calculations based on the status bar. so here is the fix for standard presenter

CGFloat x = [[UIApplication sharedApplication]isStatusBarHidden] ? [[UIScreen mainScreen]bounds].size.width/2 - width/2 : (MAX(statusBarSize.width, statusBarSize.height) - width) / 2.0;

and smoke style

CGFloat x = [[UIApplication sharedApplication]isStatusBarHidden] ? [[UIScreen mainScreen]bounds].size.width/2 - bannerSize.width/2 : (MAX(statusBarSize.width, statusBarSize.height) / 2) - (bannerSize.width / 2);

It would also be awesome if you could put this hotfix in the podspec as sometimes i have reinstall all my pods, because my project has a fit, and i have to reapply this every time.

Thanks for an awesome bit of code BTW

Genhain commented 10 years ago

Made a pull request with the fix...closing