Git Product home page Git Product logo

jogendra / badgehub Goto Github PK

View Code? Open in Web Editor NEW
810.0 810.0 70.0 79 KB

A way to quickly add a notification badge icon to any view. Make any view of a full-fledged animated notification center.

Home Page: https://jogendra.github.io/

License: MIT License

Ruby 4.93% Swift 95.07%
animations cocoapods hacktoberfest ios notifications pod podfile swift swift-framework swift-language swift5 xcode

badgehub's Introduction

badgehub's People

Contributors

amrangry avatar jogendra avatar matrixsenpai avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

badgehub's Issues

UITableViewCell

how to you set the badge to be upper left corner in the text of a UITableViewCell.textLabel ? I tried setCircleAtFrame and it shows up left but cut off and when I scroll then it shows up left and a second one on the right? With dequeue do I have to do something to use it in a UITableViewCell?

maxCount is not taken into account when calling the increment method

Hello everybody!

I've found out that maxCount is taken into account only when we call the setCount method, unfortunately, this constant doesn't apply for calls of increment. Example:

hub.setMaxCount(99)
hub.increment(by: 150)
// count == 150

Compare their implementations to each other. increment:

    /// Increases count by 1
    public func increment() {
        increment(by: 1)
    }
    
    /// Increases count by amount.
    /// - Parameter amount: Increment count.
    public func increment(by amount: Int) {
        count += amount
    }

setCount:

    /// Set the count yourself.
    /// - Parameter newCount: New count to be set to badge.
    public func setCount(_ newCount: Int) {
        self.count = newCount
        let labelText = count > maxCount ? "\(maxCount)+" : "\(count)"
        countLabel?.text = labelText
        checkZero()
    }

init?(barButtonItem: UIBarButtonItem) create nil BadgeHub

When the barButtonItem create by storyboard, init?(barButtonItem: UIBarButtonItem) create not nil BadgeHub.

But when the barButtonItem create by code in viewDidLoad function, init?(barButtonItem: UIBarButtonItem) create a nil BadgeHub, but barButtonItem is not nil.

    let hub = BadgeHub(barButtonItem: testItem)
    hub?.increment()
    
    let leftItem = UIBarButtonItem(title: "Badge", style: .plain, target: self, action: nil)
    navigationItem.leftBarButtonItem = leftItem
    
    let itemHub = BadgeHub(barButtonItem: leftItem)
    itemHub?.increment(by: 10)

hub create by Storyboard's UIBarButtonItem ,itemHub create by code UIBarButtonItem: leftItem

hub is not nil, itemHub is nil

SetCount to 0 and checkZero not removing red dot

When setting my count to 0 the red dot stays as 1 and does not disappear.

I have tried to call checkZero( ), decrement the count from one to zero instead of set to zero, and even refresh the views but nothing has worked.

Is there a way to remove the hub from the view it is attached to? I looked around for removing subviews from views but I could not find anything.

badgehub screen shot.pdf

Badge hiding behind view.

I am trying to append badgehub onto a UIImageView. The badge is appearing however when it reaches the corner; it stays behind the imageview or view and just hides away.

I tried setting the z-index however that doesn't seem to be affecting anything. Anyone else having this issue? Or found a solution. Cheers

let hub = BadgeHub(view: cell.contentView) // Initially count set to 0
hub.hubView?.layer.zPosition = 10000
hub.increment()

Hide Count hiding wrong object?

Shouldn't Hide Count hide the label and not the badge? (it currently hides the badge and leaves the number)

/// Hide the count (Blank Badge).
/// Remember this only hide count,
/// and not the red dot.
public func hideCount() {
countLabel?.isHidden = true
}

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.