KrauseFx / TSMessages

💌 Easy to use and customizable messages/notifications for iOS à la Tweetbot
http://krausefx.com
MIT License
4.87k stars 721 forks source link

Dealing with unusual navbar heights/positioning (e.g. TLYShyNavBar) #251

Open winzig opened 9 years ago

winzig commented 9 years ago

I've been making small hacks to a fork of TSMessages to make it work better in a project I'm working on. Recently we began using TLYShyNavBar, which offers Facebook/Instagram-like shrinking of the navbar as you scroll.

An issue with that is that my TSMessage alerts were appearing with a gap above them when the navbar had been shrunk, due to scrolling down the page.

After some testing, it appears that TLYShyNavBar doesn't actually shrink the navbar, but instead slides it up and out of view. In other words, instead of the navbar's center.y being at the usual 42, it ends up at -2 when slid out of sight by TLYShyNavBar's behavior.

I added this line to TSMessages right below line 220 of the current TSMessage.m, in the fadeInCurrentNotification method:

verticalOffset += ([currentNavigationController navigationBar].center.y - 42);

This seems to work well, but I'm not well versed in how TSMessages works exactly, so I'm presenting it here as both a "maybe this will help you" and also a "am I doing this right?" kind of thing. :-)

Mazyod commented 8 years ago

You might want to try the new TLYShyNavBar version. It should resolve most "gap" issues ;) .. Thanks for using it, btw!