TimOliver / TOSegmentedControl

A segmented control in the style of iOS 13 compatible with previous versions of iOS.
MIT License
196 stars 24 forks source link

Refine Label Layout Code #6

Closed TimOliver closed 4 years ago

TimOliver commented 4 years ago

A very small PR. I noticed a glitch where the reversible arrow graphic would periodically jump up 1 point.

It turns out this is because [UILabel sizeToFit] can sometimes be a bit unpredictable in terms of floating point height, and the number of times I was calling layoutSubviews meant it was potentially jittering un-necessarily.

This PR makes it so sizeToFit is called more sparingly, which fixed the layout issue.

I also did a per-pixel compare to UISegmentedControl and discovered the inner view box wasn't rounded enough by a value of 0.5. That's fixed as well. :)