Nicolai
Nicolai

Reputation: 328

Change Layout for UISegmentedControl?

currently I'm using the SVSegmentedControl by Sam Vermette - works great, but I'm asking myself if it's possible to change the layout of the SVSegmentedControl or the UISegmentedControl in general?

I want to have 2 rows with 2 "cells" / row, is that somehow possible?

Thanks

Upvotes: 0

Views: 581

Answers (2)

Dustin
Dustin

Reputation: 6803

If you want to have 2 rows, each with two cells, this isn't a thing that you can change with default segmented control behavior.

If you want something that looks like a box with 4 sections and behaves like a segmented control (only allows one part to be selected) then create 2 segmented controls. Customize how "it"(they) look(s) with backgroundImageForState:barMetrics: and other similar methods. When you detect that one of the control's parts has been selected, then deselect all of the other parts in both controls.

Upvotes: 2

Jonathan King
Jonathan King

Reputation: 1528

If you look at the source code, it doesn't actually inherit from UISegmentedControl, instead from UIControl. So if you wan't to customise UISegmentedControl, your best bet looks like building a similarly behaving control from scratch.

Upvotes: 1

Related Questions