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

Different font size for normal and selected cause title stack #90

Closed
icefox57 opened this issue Dec 10, 2018 · 4 comments
Closed

Different font size for normal and selected cause title stack #90

icefox57 opened this issue Dec 10, 2018 · 4 comments

Comments

@icefox57
Copy link

image
image

//------------------------------Setup Segmented Control------------------------------
        indicatorControl = BetterSegmentedControl(
            frame: CGRect(x: 0.0, y: 0.0, width: segementedControl.bounds.width, height: 40),
            segments: LabelSegment.segments(withTitles: ["全部".localized, "未拜访".localized,"进行中".localized,"已完成".localized],
                                            normalFont: UIFont.systemFont(ofSize: 14),
                                            normalTextColor: #colorLiteral(red: 0.9759296775, green: 0.976655066, blue: 0.9794365764, alpha: 1),
                                            selectedFont: UIFont.systemFont(ofSize: 16),
                                            selectedTextColor: #colorLiteral(red: 1, green: 1, blue: 1, alpha: 1)),
            index: 0,
            options: [.backgroundColor(.clear),
                      .indicatorViewInset(0)
            ])
        
        indicatorControl.autoresizingMask = [.flexibleWidth]
        indicatorControl.addTarget(self, action: #selector(segementValueChanged(_:)), for: .valueChanged)
        
        let customSubview = UIView(frame: CGRect(x: 0, y: 36, width: 40, height: 4.0))
        customSubview.backgroundColor = UIColor(hex:"#EF5350")
        customSubview.autoresizingMask = [.flexibleLeftMargin, .flexibleRightMargin]
        indicatorControl.addSubviewToIndicator(customSubview)
        segementedControl.addSubview(indicatorControl)
@icefox57 icefox57 changed the title Different font size for normal and selected case title stacked Different font size for normal and selected cause title stacked Dec 10, 2018
@icefox57 icefox57 changed the title Different font size for normal and selected cause title stacked Different font size for normal and selected cause title stack Dec 10, 2018
@gmarm
Copy link
Owner

gmarm commented Dec 14, 2018

You can try setting a background color for the indicator view, other than transparent.

@icefox57
Copy link
Author

but you can see , my background is a irregular shape . if i set background color , it will not match the UI design. is there any solution?

@gmarm
Copy link
Owner

gmarm commented Dec 21, 2018

No, at least not with the current implementation. 😕

@icefox57
Copy link
Author

thank you

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

2 participants