iOS Question How to customize the SegmentedControl

Ju Yang

Active Member
Licensed User
I'm using the SegmentedControl in a page, but the default appearance style of the SegmentedControl is not what I want, i.e., I need to customize the background, selected background, text color, font and font size, even put some images or icons besides the text...
Orz... Too many requests? Let's say how to implement a SegmentedControl like this:
%E5%B1%8F%E5%B9%95%E5%BF%AB%E7%85%A7-2016-05-22-%E4%B8%8A%E5%8D%8811-07-54-png.44269


Say there are three tabs, and the middle tab is currently selected. I guess we can use a "selected background image" with the correct background color and a red line on the bottom of it. But it is still necessary to change the selected text color and the font, right?
Could anyone help to write some code fragments to demonstrate how to do it?
Thanks in advance!
 

Attachments

  • 屏幕快照 2016-05-22 上午11.07.54.png
    屏幕快照 2016-05-22 上午11.07.54.png
    27.9 KB · Views: 240

Ju Yang

Active Member
Licensed User
There is the built-in TabBarController which is a bit similar. The other option is to implement this interface with buttons and a bitmap for the horizontal line.
I don't quite understand your saying "implement this interface with buttons and a bitmap". Do you mean we should define 3 buttons and set the selected background and should handle the events manually...?
Could you please show me some step by step example code for it?
 
Upvote 0
Top