Yalantis/Segmentio

Changing state does not change label font and color, only background

Closed this issue · 1 comments

Report

Report a bug

What did you do?

Set up new project, added Segmentio pod, used code from Example with .onlyLabel and custom colors:

    let font = UIFont.systemFont(ofSize: 14)
    return SegmentioStates(
        defaultState: segmentioState(
            backgroundColor: .clear,
            titleFont: font,
            titleTextColor: .lightGray
        ),
        selectedState: segmentioState(
            backgroundColor: .cyan,
            titleFont: font,
            titleTextColor: .blue
        ),
        highlightedState: segmentioState(
            backgroundColor: .lightGray,
            titleFont: font,
            titleTextColor: .red
        )
    )

Example does not work properly either.

What did you expect to happen?

When switching state the selected item should change background color, text color and font.

What happened instead?

Switching state only changes background color. Indicator works correctly.

Your Environment

  • Version of the component: 2.1 from Cocoapods
  • Swift version: 3.0
  • iOS version: 10.1.1 / 10.1
  • Device: iPhone 6 / iOS Simulator
  • Xcode version: 8.1

Stack

   CocoaPods : 1.2.0.beta.1
        Ruby : ruby 2.0.0p648 (2015-12-16 revision 53162) [universal.x86_64-darwin16]
    RubyGems : 2.0.14.1
        Host : Mac OS X 10.12.1 (16B2657)
       Xcode : 8.1 (8B62)
         Git : git version 2.9.3 (Apple Git-75)
Ruby lib dir : /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib
Repositories : master - https://github.com/CocoaPods/Specs.git @ 5f7c2c8d410e7a0cb8af5b4c1c9cf368f18ee6d8

Installation Source

Executable Path: /usr/local/bin/pod

Plugins

cocoapods-deintegrate : 1.0.1
cocoapods-plugins     : 1.0.0
cocoapods-search      : 1.0.0
cocoapods-stats       : 1.0.0
cocoapods-trunk       : 1.1.1
cocoapods-try         : 1.1.0

Podfile

platform :ios, '9.0'

target 'SegmentioTest' do
  use_frameworks!

  pod 'Segmentio', '~> 2.1'

end

My first guess was iOS10 cell prefetching in collectionView but then it should work in 9.3, yet it doesn't. Maybe some issues with text label rendering? I don't really know 😢

Thanks for this great library!

I have reproduced the issue... I´m sure that in in the previous version it was working. Please we need a hotfix :)