terryworona / TWMessageBarManager

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

iOS 8 landscape orientation issue #59

Closed ivanharmat closed 10 years ago

ivanharmat commented 10 years ago

How could this be fixed? Messages work fine with portrait orientation, but they are either cut off (iPhone) or all over the screen (iPad). iOS 7 works like a charm, both orientations. Thank you.

terryworona commented 10 years ago

Haven't looked into it. No time at the moment. Give it a try!

ivanharmat commented 10 years ago

Alright, I'll see what I can do. Thanks for the quick reply.

ivanharmat commented 10 years ago

I did not spend much time trying to fix it, but this little hack fixes the iOS 8 issue for me:

- (CGRect)orientFrame:(CGRect)frame
{
    NSString *systemVersion = [UIDevice currentDevice].systemVersion;
    NSUInteger systemInt = [systemVersion intValue];

    if ( (UIDeviceOrientationIsLandscape([UIDevice currentDevice].orientation) || UIDeviceOrientationIsLandscape([UIApplication sharedApplication].statusBarOrientation)) && systemInt < 8 )
    {
        frame = CGRectMake(frame.origin.x, frame.origin.y, frame.size.height, frame.size.width);
    }
    return frame;
}

I just simply added an iOS version number to the if conditional above.

PhillipApps commented 10 years ago

Having the same issue in landscape, the bar is taking the whole view unfortunately.

ivanharmat commented 10 years ago

have you tried to replace the orientFrame method with the one above? That fixed the problem for me.

PhillipApps commented 10 years ago

Yes I tried, but problem is that when I turn my device, tap on the button which shows the message, it's shown as portrait

EDIT: Tried again it works! Thanks man. Don't know why it was bugging me yesterday.

terryworona commented 10 years ago

@ivanharmat do you want to submit a pull request with your patch?

ivanharmat commented 10 years ago

sure. thanks. I'll get to it right now.

ivanharmat commented 10 years ago

@terryworona I can't push my branch to git. It says "Permission to terryworona/TWMessageBarManager.git denied to ivanharmat." Can you updated the code and create a new commit?

terryworona commented 10 years ago

You'll have to issue a pull request @ivanharmat

See: https://help.github.com/articles/using-pull-requests

I can cherry pick your code but then you won't get any credit :)

ivanharmat commented 10 years ago

OK @terryworona, let me try again. I need to learn this anyway :)

MittalBanker commented 9 years ago

@PhillipApps Please replace orientFrame method with this

frame = CGRectMake(frame.origin.x, frame.origin.y, frame.size.height, frame.size.width); in original code which should be like this

frame = CGRectMake(frame.origin.x, frame.origin.y, frame.size.width, frame.size.height);

thanks