Yalantis / Segmentio

Animated top/bottom segmented control written in Swift.
https://yalantis.com/
MIT License
2.53k stars 324 forks source link

Label text is not completely shown. #40

Open kwstasna opened 7 years ago

kwstasna commented 7 years ago

Report a bug

What did you do?

 public func segmentioOptions() -> SegmentioOptions {

        return SegmentioOptions(backgroundColor: .lightGray, maxVisibleItems: 4, scrollEnabled: true, indicatorOptions: segmentioIndicatorOption(), horizontalSeparatorOptions: nil, verticalSeparatorOptions: segmentioVerticalSperator(), imageContentMode: .scaleAspectFit, labelTextAlignment: NSTextAlignment.left, labelTextNumberOfLines: 1, segmentStates: segmentioStates(), animationDuration: 0.5
        )

    }

    fileprivate func segmentioStates() -> SegmentioStates {

        return SegmentioStates(
            defaultState: SegmentioState(
                backgroundColor: .lightGray,
                titleFont: UIFont.systemFont(ofSize: 8),
                titleTextColor: .white
            ),
            selectedState: SegmentioState(
                backgroundColor: .lightGray,
                titleFont: UIFont.systemFont(ofSize: 8),
                titleTextColor: .white
            ),
            highlightedState: SegmentioState(
                backgroundColor: UIColor.lightGray.withAlphaComponent(0.6),
                titleFont: UIFont.boldSystemFont(ofSize: 8),
                titleTextColor: .white
            )
        )

    }

    fileprivate func segmentioVerticalSperator() -> SegmentioVerticalSeparatorOptions {
        return SegmentioVerticalSeparatorOptions(
            ratio: 1, // from 0.1 to 1
            color: .black
        )
    }

    fileprivate func segmentioIndicatorOption() -> SegmentioIndicatorOptions {
        return SegmentioIndicatorOptions(
            type: .bottom,
            ratio: 1,
            height: 5,
            color: .red
        )
    }

What did you expect to happen?

This image shows what i expect to happen.

http://i.imgur.com/LUVMYQm.png

What happened instead?

Except the background color which is for test only. My only issue is about the label text it has to be like the image on "what i expect to happen"

http://i.imgur.com/Gb9NLPy.png

Your Environment

   CocoaPods : 1.1.0.rc.2
        Ruby : ruby 2.0.0p648 (2015-12-16 revision 53162) [universal.x86_64-darwin16]
    RubyGems : 2.6.6
        Host : Mac OS X 10.12.1 (16B2327e)
       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 @ aa500a428f80c8e56a48e94a019fb8b59c74d79a
               master copy - https://github.com/CocoaPods/Specs.git @ aa500a428f80c8e56a48e94a019fb8b59c74d79a

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

# Uncomment the next line to define a global platform for your project
# platform :ios, '9.0'

target 'Testy' do
  # Comment the next line if you're not using Swift and don't want to use dynamic frameworks
  use_frameworks!

  # Pods for Testy

    pod 'Alamofire', '~> 4.0’
    pod 'Fabric'
    pod 'Crashlytics'
    pod 'Kingfisher', '~> 3.0'
    pod 'Siren'
    pod 'Segmentio', '~> 2.1'
    pod 'DeviceKit', '~> 1.0'
    pod 'UIColor_Hex_Swift', '~> 3.0.2'
    pod 'DropDown'
    pod 'Eureka', '~> 2.0.0-beta.1'
    pod 'PasswordTextField'
    pod 'FacebookCore'
    pod 'FacebookShare’
    pod 'FBNotifications'
    pod 'SkyFloatingLabelTextField', '~> 2.0.0'
    pod 'PopupDialog', '~> 0.5'
    pod ‘IQKeyboardManagerSwift’

end

Project that demonstrates the bug

Its just a simple setup.

Gurbo commented 7 years ago

@kwstasna I've faced this problem too, the solution is to use version 2.1.1. not 2.1.2 Here is the code solution https://github.com/Gurbo/Segmentio/commit/370ca73fd0efd6149a55ab6ba3bc16b4e2a1bbaf

kwstasna commented 7 years ago

@Gurbo yes when i run pod install i see that Using Segmentio (2.1.2) how can i install 2.1.1 ??? Thanks for the answer !!

Gurbo commented 7 years ago

@kwstasna i've just downloaded 2.1.2, changed source code and pushed it to my repository. Don't know how to download 2.1.1 @dimazen