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

Please add spacing lines #149

Open
kacok opened this issue Dec 21, 2020 · 1 comment
Open

Please add spacing lines #149

kacok opened this issue Dec 21, 2020 · 1 comment

Comments

@kacok
Copy link

kacok commented Dec 21, 2020

such as A | B | C | D

@roMummy
Copy link

roMummy commented Sep 7, 2021

You can add lineview to normalView.
But it's not very convenient.
Like this:

     lazy var segmentedControl = BetterSegmentedControl().then {
        $0.backgroundColor = .white
        
        var mArr = [BetterSegmentedControlSegment]()
        // left
        let leftSegment = IconSegment(icon: R.image.cut_minus_icon()!, iconSize: CGSize(width: 10, height: 1), normalIconTintColor: .black, selectedIconTintColor: .black)
        let line1 = UIView()
        line1.frame = CGRect(x: 123/3 - 2, y: 0, width: 2, height: 30)
        line1.backgroundColor = .black
        leftSegment.normalView.addSubview(line1)
        
        mArr.append(leftSegment)
                                
        // center
        mArr.append(LabelSegment(text: "0"))
        
        // right
        let rightSegment = IconSegment(icon: R.image.cut_minus_icon()!, iconSize: CGSize(width: 10, height: 1), normalIconTintColor: .black, selectedIconTintColor: .black)
        let line2 = UIView(frame: CGRect(x: 0, y: 0, width: 2, height: 30))
        line2.backgroundColor = .black
        rightSegment.normalView.addSubview(line2)
        
        mArr.append(rightSegment)
        
        
        $0.segments = mArr
        $0.indicatorViewBackgroundColor = .clear
                
        $0.backgroundColor = .white
        $0.layer.borderColor = UIColor.black.cgColor
        $0.layer.borderWidth = 1
        
        $0.cornerRadius = 8
        
        $0.addTarget(self, action: #selector(segmentedControlChanged(_ :)), for: .valueChanged)
    }

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

No branches or pull requests

3 participants