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

BarButtonItem #7

Open
syedrazackimran opened this issue Sep 4, 2020 · 0 comments
Open

BarButtonItem #7

syedrazackimran opened this issue Sep 4, 2020 · 0 comments

Comments

@syedrazackimran
Copy link

syedrazackimran commented Sep 4, 2020

Hi hello,

I am facing two kinds of issues,

  1. BarButton.

when I added with button and imageview it works cool. i am trying to add with NavigationItem.BarButtonItems
it's not showing kindly do needful.

    private var bageController: BadgeController!

    lazy var naviCartButton: UIButton = {
        $0.setImageForAllStates(UIImage(named: "icon_cart_color")!)
        $0.imageEdgeInsets = .init(top: 5, left: 5, bottom: 5, right: 5)
        $0.addTarget(self, action: #selector(self.openCart), for: .primaryActionTriggered)
        return $0
    }(UIButton())

override func viewDidLoad() {
        super.viewDidLoad()
  self.navigationItem.rightBarButtonItem = UIBarButtonItem(customView: naviCartButton)
        setupBadgeView()
        // Do any additional setup after loading the view.
    }
private func setupBadgeView() {
        guard let customView = self.navigationItem.rightBarButtonItem?.customView as? UIButton else {
            return
        }
        bageController = BadgeController(for: naviCartButton)
        bageController.centerPosition = .upperRightCorner
        bageController.badgeTextColor = .white
        bageController.badgeBackgroundColor = ApplicationColor.bright
        bageController.animateOnlyWhenBadgeIsNotYetPresent = true
        bageController.badgeTextFont = Font(.installed(.OpenSansSemiBold), size: .standard(.h5)).instance
        bageController.addOrReplaceCurrent(with: "1", animated: true)
    }

  1. Round Alignment.

When it goes to single digits to double digit (9 to 10 and 10 to 9), Badge roundview is breaking
Refer Below ScreenShots

Simulator Screen Shot - iPhone 11 Pro Max - 2020-09-04 at 11 35 15

Simulator Screen Shot - iPhone 11 Pro Max - 2020-09-04 at 11 35 13

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

1 participant