Closed cytryn closed 10 years ago
+1
+1
Well since everyone else is doing it, +1
So, the consensus is to have the message view cover the status bar as it drops down? Can you elaborate on what you mean by "This way on dont depend on app design for the warning box to make sense." ?
I dig the message bar covering the status bar. From a really quick look at the code, I think the quick way to achieve this effect is to remove self.messageBarOffset at line 196:
[UIView animateWithDuration:kTWMessageBarManagerAnimationDuration animations:^{
messageView.frame.origin.y + [messageView height], [messageView width], [messageView height])]; // slide down
}];
And to hide the status bar during the duration of the animations.
Alternatively, if you still want the status bar to be visible, you could make the message bar 20 pixels taller, while setting the self.messageBarOffset to 0, and shifting all of the content inside down 20 pixels to account for the status bar's height.
I'd suggest to add a method in the interface to keep the old behavior but set the cover as default, cause that's how iOS 7 supports to work.
@terryworona What I meant is that covering the status bar with the same color wont break the design because you can have for example a navigation bar in one color and the view background in another color.
Then the message would appear in a third completely different color making it appear ugly as hell...
@terryworona I have opened a pull request for this requested feature.
Pushed a few updates related to this. However, I can't seem to get the message views to cover the status bar entirely.
We could hide the status bar, but that requires setting a project plist value (see: http://stackoverflow.com/questions/18059703/cannot-hide-status-bar-in-ios7).
To see what I'm talking about, uncomment line 281 of the TWMessageBarManager (v1.3.1) & notice how the view appears underneath the status bar.
Any ideas?
Is it really necessary to display the message on top of the StatusBar? To be able to do that the developers may have to interfer with UIViewControllerBasedStatusBarAppearance
or -prefersStatusBarHidden
. And it may result in strange behaviour in other 3rd party components (or when displaying a MFMailComposeViewController
or an UIImagePickerController
)
Instead of showing the message on top of the Statusbar i like what @terryworona suggested as an alternative; To show the message underneath the Statusbar. I've done some testing and i like the look: http://f.cl.ly/items/1R141v1p1R0N2S261h2Z/iOS%20Simulator%20Screen%20shot%2015%20jan%202014%2010.25.12.png
What do you guys think?
@Amnell that is what we are all talking about. Keeping the status bar visible or not is really not an issue. The important thing here is to have the status bar have the same background as the message.
Ah ok, now I understand. Screenshots help!
So for iO7, set the message view's origin to be y-statusBar.height and extend it's height+=statusBar.height.
Sound about right?
Well, @Amnell, Tapbots with Tweetbot 3 implement a very similar looking control to this one (even has a message queue as well), but they hide the status bar when showing the various messages (either blue for info or red for warning). The status bar appears and disappears naturally after each message. If there is a queue, the status bar disappears on the first message and only reappears when the last message disappears.
I've been able to implement a way to hide the status bar when showing just one message and then animate it back in when it disappears or the user taps on a button, but as soon as multiple messages start coming in, my code no longer is optimal.
Basically, my implementation is simple (you can implement this in TWMesssageBarDemoController.m
). Create a boolean:
@property (nonatomic) BOOL hideBar;
And then to implement the hiding and unhiding, for example:
- (void)errorButtonPressed:(id)sender
{
[self performSelector:@selector(hide) withObject:self afterDelay:0];
[[TWMessageBarManager sharedInstance] showMessageWithTitle:kStringMessageBarErrorTitle
description:kStringMessageBarErrorMessage
type:TWMessageBarMessageTypeError
callback:^{
[self unhide];
}];
// the delay is hardcoded just as an example, maybe expose this internal value to the developer?
[self performSelector:@selector(unhide) withObject:self afterDelay:3.25]; }
- (void)unhide {
[UIView animateWithDuration:0.1 animations:^{
self.hideBar = NO;
[self setNeedsStatusBarAppearanceUpdate];
}];
}
- (void)hide {
[UIView animateWithDuration:0.1 animations:^{
self.hideBar = YES;
[self setNeedsStatusBarAppearanceUpdate];
}];
}
@paradoxally The problem with that solution is that it will be harder to implement TWMessageBarManager
as UIViewControllerBasedStatusBarAppearance
cant be set to NO and the implementing ViewController needs a fair bit of code.
Ideally TWMessageBarManager
should be a drop-in module that doesn't force the developer to change a bunch of stuff in ther application or ViewControllers.
@terryworona that would be great!
I've created pull request #22 for the behavior I described earlier in this thread.
Hey everyone, fixed this issue in commit: f4400e80583672ff0bf0a9400e506ed60f9ac8b3
I kept it simple:
If >= iOS 7 -> extend the message view's height by the status bar height and set it's y offset to be the status bar's max y-position. As well, push the content of the message view down by the status bar height.
Hope this helps.
Fixed in v1.3.2
It would be more awesome if the message background covers the status bar on iOS 7
This way on dont depend on app design for the warning box to make sense.