Giter Club home page Giter Club logo

flexiblesteppedprogressbar's People

Contributors

aclima93 avatar amratab avatar denismullaraj avatar fumiyasac avatar mahesh-agrawal-616 avatar mohpor avatar pedrofabrino 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  avatar  avatar

flexiblesteppedprogressbar's Issues

Reloading views

I am doing live language change to my app but I cant find any way to reload progress bar texts to update texts

Fill all States

hi Amrata,

i was wondering is there a way to fill all states till the last one (currently fill all before current Index)

thanks in advance

change label text color of previous and next indicator

I want to make it same color of selected to previous same and next all should be same.
For example: I have 4 progress and if i am at second index, than first and second label text color want same and other text color want different.

second example : If i am at 3rd index, so first/second/third index color want same and forth index color want different. if i will click on previous from 3rd index , means now i am at second, so first/second color want same other want different.

Let me know how to achieve this ?
Please refer attached screenshot.

Screenshot 2020-04-21 at 3 23 46 PM

didSelectItemAtIndex() delegate not fired after setting current index

Hi, for first, good job !

I just see that didSelectItemAtIndex() delegate method is not fired after setting current index, just need to call in setter

FlexibleSteppedProgressBar.swift

/// The current selected index
    open var currentIndex: Int = 0 {
        willSet(newValue){
            if let delegate = self.delegate {
                delegate.progressBar?(self, willSelectItemAtIndex: newValue)
            }
        }
        didSet {
//            animationRendering = true
            self.setNeedsDisplay()
            if let delegate = self.delegate {
                delegate.progressBar?(self, didSelectItemAtIndex: currentIndex)
            }
        }
    }

Step text into 2 lines???

I set the text to "Order\ndelivered" with a "\n" newline in between. but it only shows "Order" not "delivered" on the second line. Can you support that??

Text Overflowing

I can't seem to figure out why the label text is too large and overflowing into the next item. Any ideas?
image 2019-02-06 at 6 46 07 am

 var progressBar: FlexibleSteppedProgressBar!
    var progressBarWithoutLastState: FlexibleSteppedProgressBar!
    var progressBarWithDifferentDimensions: FlexibleSteppedProgressBar!
    
    var backgroundColors = UIColor(red: 112.0 / 255.0, green: 160.0 / 255.0, blue: 71.0 / 255.0, alpha: 1.0)
    var progressColor = UIColor(red: 112.0 / 255.0, green: 160.0 / 255.0, blue: 71.0 / 255.0, alpha: 1.0)
    var textColorHere = UIColor(red: 153.0 / 255.0, green: 153.0 / 255.0, blue: 153.0 / 255.0, alpha: 1.0)

    var maxIndex = -1

override func setSelected(_ selected: Bool, animated: Bool){
        super.setSelected(selected, animated: animated)
    }
    
    func setupProgressBar(selected: Int) {
        progressBar = FlexibleSteppedProgressBar()
        progressBar.translatesAutoresizingMaskIntoConstraints = false
        for view in self.subviews {
            if let progress = view as? FlexibleSteppedProgressBar {
                progress.removeFromSuperview()
            }
        }
        self.addSubview(progressBar)
        
        // iOS9+ auto layout code
        let horizontalConstraint = progressBar.centerXAnchor.constraint(equalTo: self.centerXAnchor)
        let verticalConstraint = progressBar.topAnchor.constraint(
            equalTo: self.topAnchor,
            constant: 80
        )
        let widthConstraint = progressBar.widthAnchor.constraint(equalToConstant: SCREEN_WIDTH - 36)
        let heightConstraint = progressBar.heightAnchor.constraint(equalToConstant: CGFloat(64))
        NSLayoutConstraint.activate([horizontalConstraint, verticalConstraint, widthConstraint, heightConstraint])
        
        // Customise the progress bar here
        progressBar.numberOfPoints = 6
        progressBar.lineHeight = 2
        progressBar.radius = 5
        progressBar.progressRadius = 6
        progressBar.progressLineHeight = 2
        progressBar.delegate = self
        progressBar.completedTillIndex = selected
        progressBar.useLastState = true
        progressBar.lastStateCenterColor = progressColor
        progressBar.selectedBackgoundColor = progressColor
        progressBar.selectedOuterCircleStrokeColor = progressColor
        progressBar.lastStateOuterCircleStrokeColor = progressColor
        progressBar.currentSelectedCenterColor = progressColor
        progressBar.currentSelectedTextColor = progressColor
        progressBar.currentIndex = 0
    }
    
    func progressBar(_ progressBar: FlexibleSteppedProgressBar,
                     didSelectItemAtIndex index: Int) {
        progressBar.currentIndex = index
        if index > maxIndex {
            maxIndex = index
            progressBar.completedTillIndex = maxIndex
        }
    }
    
    func progressBar(_ progressBar: FlexibleSteppedProgressBar,
                     canSelectItemAtIndex index: Int) -> Bool {
        return false
    }
    
    func progressBar(_ progressBar: FlexibleSteppedProgressBar,
                     textAtIndex index: Int, position: FlexibleSteppedProgressBarTextLocation) -> String {
        
        if progressBar == self.progressBar || progressBar == self.progressBarWithoutLastState {
            if position == FlexibleSteppedProgressBarTextLocation.top {
                switch index {
                    
                case 0: return "Quote Pending"
                case 1: return "Quote Approved"
                case 2: return " Route "
                case 3: return "Getting Swerviced"
                case 4: return "Swervice Complete"
                case 5: return "Delivery Complete"
                default: return "Nothing"
                }
            }
        }
        return ""
    }

Gradient

How can I make the fill color a gradient instead of a solid color?

How to go next step animated?

Hi. when I use currentIndex, it's going to next step but not animated. How can I go to next step programmatically and animated?

Set stepText indices font?

Is it possible to set a font for the indices only? I don't set a font at all and get this Warning ->

CoreText performance note: Client called CTFontCreateWithName() using name ".SFUI-Semibold" and got font with PostScript name "TimesNewRomanPSMT". For best performance, only use PostScript names when calling this API.

Progress bar disappears but the text remains

Hi,

I created a progress bar with 4 points (progressBar.numberOfPoints = 4), but later I want to change this existing progress bar to 1 point (progressBar.numberOfPoints = 1).

The problem is, when I try to change to number of points from 4 to 1, the points disappear, but their texts remain. Following screenshots:

Initially, with 4 points:
4 steps

After progressBar.numberOfPoints = 1, with 1 point:
1 step

This is the code in my delegate:

    func progressBar(_ progressBar: FlexibleSteppedProgressBar, textAtIndex index: Int,
                     position: FlexibleSteppedProgressBarTextLocation) -> String {

        if position == FlexibleSteppedProgressBarTextLocation.bottom {
            switch index {
            case 0: return "BOOKED"
            case 1: return "ON THE WAY"
            case 2: return "SERVICING"
            case 3: return "COMPLETED"
            default: return "NONE"
            }
        }

        return ""
    }

How can I make the text under the points disappear as well when I go from 4 to 1 points?

Hide top and bottom label

Hii,
I'm working on a project where only need FlexibleSteppedProgressBar but not label which is shown at top and bottom. can you suggest how to customize it?

I need something like below one
img_0638

the progress bar doesn't support RTL

Hi
I have an app which support 2 language (arabic, English)
LTR & RTL
so in arabic I need it start form Right to left side

I tried to perform "transform" but it Mirrors the whole view with all its content and I can't control the labels because its text layers , could you provide me with a solution

thanks a lot for this

arbitrary segment lengths?

Just wondering if this library supports arbitrary segmetn lengths? for example i want from segment 1 (point 0 to point 1) to be 100 px, but i want the second segment (point 1 to point 2) to be 400 px. I guess I could just use 2 separate instances now that im thinking about it.

Titles from both the end are clipping

I am using this library and I am getting this issue. Titles from both the end are getting clipped. This is happening in all the screens width and for number of points. Here is the screenshot for the same.
simulator screen shot - iphone 8 plus - 2018-05-18 at 18 20 47

Set previous selected to image

Is there a way to set an image inside of the steps when they have been selected?
possibly even by using a nsattributedstring?

Not able to get progress bar where selected steps has white color text and remaining step has gray color text

I want stepper like this one
Screenshot 2020-03-18 at 9 17 12 AM

And I have written below code:

func setupProgressBarWithDifferentDimensions() {
        progressBarWithDifferentDimensions = FlexibleSteppedProgressBar()
        progressBarWithDifferentDimensions.translatesAutoresizingMaskIntoConstraints = false
        self.view.addSubview(progressBarWithDifferentDimensions)
        
        // iOS9+ auto layout code
        let horizontalConstraint = progressBarWithDifferentDimensions.centerXAnchor.constraint(equalTo: self.view.centerXAnchor)
        let verticalConstraint = progressBarWithDifferentDimensions.topAnchor.constraint(
            equalTo: view.topAnchor,
            constant: 450
        )
        let widthConstraint = progressBarWithDifferentDimensions.widthAnchor.constraint(equalToConstant: 320)
        let heightConstraint = progressBarWithDifferentDimensions.heightAnchor.constraint(equalToConstant: 25)
        NSLayoutConstraint.activate([horizontalConstraint, verticalConstraint, widthConstraint, heightConstraint])
                
        progressBarWithDifferentDimensions.numberOfPoints = 5
        progressBarWithDifferentDimensions.lineHeight = 5
        progressBarWithDifferentDimensions.progressLineHeight = 6
        progressBarWithDifferentDimensions.radius = 16
        progressBarWithDifferentDimensions.progressRadius = 16
        progressBarWithDifferentDimensions.delegate = self
        progressBarWithDifferentDimensions.selectedBackgoundColor = progressColor
        progressBarWithDifferentDimensions.backgroundShapeColor = UIColor.lightGray
//        progressBarWithDifferentDimensions.centerLayerDarkBackgroundTextColor = UIColor.green
//        progressBarWithDifferentDimensions.centerLayerTextFont = UIFont.systemFont(ofSize: 17)
        progressBarWithDifferentDimensions.selectedOuterCircleLineWidth = 0.0
        
        progressBarWithDifferentDimensions.completedTillIndex = 2
        progressBarWithDifferentDimensions.currentIndex = 2
        
        progressBarWithDifferentDimensions.stepTextColor = UIColor.yellow
        progressBarWithDifferentDimensions.currentSelectedTextColor = UIColor.white
        progressBarWithDifferentDimensions.centerLayerTextColor = UIColor.gray
    }

Selected color stays on first index

When I select an index by pressing on the element the line will move but all selected item stuff (like currentSelectedCenterColor) stay on the first index. Only setting index programmatically works but it causes "willSelectItemAtIndex" to trigger so I cannot use it in "willSelectItemAtIndex"

RTL Support

hey, cool stuff.
Is it possible to add RTL support?

Vertical Support

How to use this Library for Vertical Direction.
I want to create something like this.
Thanks.

screen shot 2018-05-11 at 2 12 31 pm

syntax error on swift 4.0

let attString = NSAttributedString(string: self.string as! String, attributes: attributes as! [String : Any]?)

This line is present in file. FSPBTextLayerExtension.swift

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.