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

The statusbar overlap badge label in navigationitem iOS 11 #28

Open
seasoft-phuc opened this issue Nov 10, 2017 · 4 comments
Open

The statusbar overlap badge label in navigationitem iOS 11 #28

seasoft-phuc opened this issue Nov 10, 2017 · 4 comments

Comments

@seasoft-phuc
Copy link

In iOS 10, it looks OK but in iOS 11, the statusbar overlap badge label when push navigation. Can anyone help me? Thanks
Please see my image: https://i.stack.imgur.com/aCKFy.png

@dcoria7
Copy link

dcoria7 commented Nov 28, 2017

Anyone can fix it?

@DamascenoRafael
Copy link

Any news about this?

@alshcompiler
Copy link

alshcompiler commented Mar 27, 2018

i found the answer in the closed issues ^__^

just add those two lines before adding the button to the bar item

button.frame = CGRectMake(0, 0, 70, 40)
button.badgeEdgeInsets = UIEdgeInsetsMake(10, 0, 0, 15)

of course you can adjust the insets to make the badge on your favourite spot

and here is a full example :

        let button = MIBadgeButton(type: .Custom)
        button.badgeString = "19"
        button.frame = CGRectMake(0, 0, 70, 40)
        button.badgeEdgeInsets = UIEdgeInsetsMake(10, 0, 0, 15)
        button.setTitle("edit", forState: .Normal)
        button.setTitleColor(UIColor.orangeColor(), forState: .Normal)
        let barButton = UIBarButtonItem(customView: button)

@DamascenoRafael
Copy link

@alshcompiler I tried exactly as you wrote, including the button as MIBadgeButton(type: .custom), but it didn't work :/ When I open the view the badget appears normal but soon after is cut by statusbar. But thanks for trying.

It's an open source project so if anyone wants to take a look at this part: https://github.com/caronae/caronae-ios/blob/master/Caronae/Ride/RideViewController%2BrideActions.swift#L24

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

4 participants