patel kavit
patel kavit

Reputation: 484

UISegmentedControl with 5-6 segments

In our application we are showing the segmented control with dynamic segments.

If number of segments is 2-3 we have no issue, but if number of segments is 5 or more than that then the text in segment is not readable.

Segmented Control

See the above image.

So, what is the alternate way to resolve this issue?

Upvotes: 0

Views: 2339

Answers (4)

iPatel
iPatel

Reputation: 47059

The best Solution is that add ScrollView in you view controller and add UISegmentController to UIScrollView and give fix size of your segment button and change size of UISegmentController Base on total numbers of button and also change content size of UIScrollView base on UISegmentController.

Upvotes: 1

Matthias Bauch
Matthias Bauch

Reputation: 90117

There are a couple of solutions.

  1. You could use a UIPickerView instead of a UISegmentedControl
  2. You could show three segments, where the first two segments are the most often used segments, and touching the third segment shows a UIPickerView with all the options.
  3. You could embed the UISegmentedControl in a UIScrollView. Make sure to size your segmented control in a way that shows that it is indeed scrollable.

Which one fits best depends on your app, and what is the actual use of those segments.

Upvotes: 3

Nikita P
Nikita P

Reputation: 4246

try setting font size for the test to be smaller, that ways, the text will be more visible. However, if your number of segments keep increasing, that wouldn't be a solution

Upvotes: 0

MrBr
MrBr

Reputation: 1916

It's hard to answer this question on a general basis. Apple's Human Interface Guidlines may be a good reference for this kind of issues.

Upvotes: 1

Related Questions