XMSegmentedControl icon indicating copy to clipboard operation
XMSegmentedControl copied to clipboard

Setting a starting selectedIndex other than 0 moves the UIButtons in XMSegmentedControl

Open xaviermerino opened this issue 9 years ago • 2 comments

Hello guys,

Whenever we have a fixed number of icons in XMSegmentedControl and we set the starting selectedIndex to something other than 0 the UIButtons get displaced.

Line 276 in XMSegmentedControl.swift should be: let frame = CGRect(x: 0 + (CGFloat(i) * width), y: 0, width: width, height: height)

Instead of: let frame = CGRect(x: starting + (CGFloat(i) * width), y: 0, width: width, height: height)

At least for the fixed icon case. Or.. we need to fix the starting problem which sounds more like the appropriate solution.

Intended Behavior: img

Wrong Behavior: img

xaviermerino avatar Feb 25 '17 22:02 xaviermerino

Bump, I am having this issue too.

d7laungani avatar Apr 02 '17 05:04 d7laungani

If you do what is specified above you will fix that problem. Just replace that one line and then you can set the position you want it in.

xaviermerino avatar Apr 02 '17 06:04 xaviermerino