ermalkaleci / CarbonKit

CarbonKit - iOS Components (Obj-C & Swift)
MIT License
682 stars 163 forks source link

Change Tab Indicator #178

Closed maclacerda closed 7 years ago

maclacerda commented 7 years ago

Hello,

First of all I would like to congratulate you for the excellent work! CarbonKit saved me!

I wanted to know if there is a way to change the width of the bookmark, just as I can change the height using the setIndicatorHeight method.

Similar this:

screen shot 2017-09-14 at 10 51 22

Thanks

ermalkaleci commented 7 years ago

@marcoslacerda There's no such method but you can do it just by adding a custom view into indicator (UIImageView) Here's obj-c example:

`[carbonTabSwipeNavigation setIndicatorColor:nil]; UIImageView *indicator = carbonTabSwipeNavigation.carbonSegmentedControl.indicator;

UIView *subview = [[UIView alloc] init]; subview.backgroundColor = [UIColor redColor]; [indicator addSubview:subview];

subview.translatesAutoresizingMaskIntoConstraints = false; [[subview.widthAnchor constraintEqualToConstant:20] setActive:true]; [[subview.centerXAnchor constraintEqualToAnchor:indicator.centerXAnchor constant:0] setActive:true]; [[subview.topAnchor constraintEqualToAnchor:indicator.topAnchor constant:0] setActive:true]; [[subview.bottomAnchor constraintEqualToAnchor:indicator.bottomAnchor constant:0] setActive:true];`

simulator screen shot - iphone 7 plus - 2017-09-15 at 13 53 46

maclacerda commented 7 years ago

@ermalkaleci Thank you for your help!

You save my Life !

=D