terryworona / TWMessageBarManager

An iOS manager for presenting system-wide notifications via a dropdown message bar.
MIT License
1.77k stars 191 forks source link

MessageBar doesn't appear if app has no status bar. #35

Closed hlung closed 10 years ago

hlung commented 10 years ago

From https://github.com/terryworona/TWMessageBarManager/blob/master/Classes/TWMessageBarManager.m#L587-L590

If app has no status bar, -statusBarFrame will return CGRectZero, making -width returns 0, which makes message bar not appear at all.

- (CGFloat)width
{
    return [self statusBarFrame].size.width;
}
- (CGRect)statusBarFrame
{
    return [self orientFrame:[UIApplication sharedApplication].statusBarFrame];
}

Suggested fix...

- (CGRect)statusBarFrame
{
    if ([UIApplication sharedApplication].isStatusBarHidden) {
        return CGRectMake(0, 0, [UIApplication sharedApplication].keyWindow.frame.size.width, 0);
    }
    else {
        return [self orientFrame:[UIApplication sharedApplication].statusBarFrame];
    }
}
terryworona commented 10 years ago

A whole slew of issues arise when a status bar is hidden and there are orientation changes.

We rely heavily on status bar orientation notifications, etc.

Will have to rethink this one...

terryworona commented 10 years ago

Hey @DanielKrofchick, any idea on how we can go about fixing this? Only thing I can think of is hardcoding the status bar sizes when isStatusBarHidden == YES for -(CGRect)statusBarFrame.

hlung commented 10 years ago

Yeah, that's what I worry about too.

On 2014/04/07, at 1:20, terryworona notifications@github.com wrote:

A whole slew of issues arise when a status bar is hidden and there are orientation changes.

We rely heavily on status bar orientation notifications, etc.

Will have to rethink this one...

\ Reply to this email directly or view it on GitHub.

DanielKrofchick commented 10 years ago

Hi @terryworona. It seems it's best then not to trigger off of the statusBar. Fortunately there's a UIDevice orientation notification. I've put together a fix. I'll send over a pull request.

terryworona commented 10 years ago

Fixed in PR #36 commit: 041fd5d9eb9975a3120b8e50c3c33dabbadd53eb

Tag: v1.4.2