2

How to create Segmented control with underline in iOS (like on image on the left)?

As far as I understood it's similar to Android native control. enter image description here

Thank you

Bogdan Laukhin
  • 1,454
  • 2
  • 17
  • 26
  • Please show us what you have tried so we can help you solve the problem. – MSU_Bulldog Feb 22 '16 at 16:58
  • I had to do the very same thing some time ago. I created a custom UIControl in swift to handle it. Here's the repo: https://github.com/johnrufusj/customSwiftControls/blob/master/UnderlineSegmentedControl.swift – Rufus Feb 22 '16 at 18:16

1 Answers1

1

UISegmentedControl includes API for customizing it's appearance. You set images for various state combinations using -setBackgroundImage:forState:barMetrics: and -setDividerImage:forLeftSegmentState:rightSegmentState:barMetrics:.

You can also customize the text using -setTitleTextAttributes:forState:.

These methods can be found in the Customizing Appearance section of the UISegmentedControl documentation.

Andrew Madsen
  • 21,309
  • 5
  • 56
  • 97