Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Badge position is not in place #4

Open
roiholtzman opened this issue Oct 22, 2014 · 4 comments
Open

Badge position is not in place #4

roiholtzman opened this issue Oct 22, 2014 · 4 comments

Comments

@roiholtzman
Copy link

I upgraded my Xcode to version 6. Now, the badge position is no longer in the right place. Does anyone know how to fix it?

@roiholtzman
Copy link
Author

My workaround was not to call setPosition, and set the centre of the view in the setBadgeValue method. But of course it's not perfect ..

@mohpor
Copy link

mohpor commented Oct 25, 2014

My solution was to edit the UIView+MGBadgeView.m and change

if(badgeValue != 0 || _displayIfZero) {
            [self mg_updateBadgeViewSize];

            if(_position == MGBadgePositionBest)
                [self mg_updateBadgeViewPosition];

        } else {
            self.frame = CGRectZero;
        }

to

if(badgeValue != 0 || _displayIfZero) {
            [self mg_updateBadgeViewSize];

            if(_position == MGBadgePositionBest)
                [self mg_updateBadgeViewPosition];

            [UIView animateWithDuration:0.2f animations:^{
                self.alpha=1.0f;
            }];

        } else {
            [UIView animateWithDuration:0.2 animations:^{
                self.alpha=0.0f;
            }];

        }

It now doesn't reposition the badge, plus animates changes between states.

@matteogobbi
Copy link
Owner

Hi, @mohpor you can also make a pool request contributing to the component if you thing you fixed something. Cheers!

@mohpor
Copy link

mohpor commented Oct 25, 2014

I'd always done that, but after so many unsuccessful try and not getting merged at all, I lost hope and stopped doing so.
Bt you're right. this is a decent control and I should do that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants