UISwitch in tvOS

Is there something similar to a UISwitch in tvOS? It's a pretty handy control. If not, is there an alternative that can archieve the same effect? I tried to use segmented control but the value is changed as soon as it become focus. I only want to call back to be triggered when the user click on it.


Thanks

I just toggle between the text "On" and "Off" similar to how Apple does in their Settings menus. (Settings>>General>>Siri for an example). If you're doing this in a UITableView then UITableViewCellStyleValue1 does the job. Now a UISlider .... that's a different matter. I could use suggestions for that.

Well, I need to have the user select one or the other, so on and off don't apply in this case. Wait...I think I should use the UISlider too....

Just use a UISegmentedController with 2 segments: On and Off.


-Brian

The problem with UISegmentedControl is that, as far as I've found, there's no way to get the actual click on one of the button segments. The Primary Action Triggered and Value Changed events fire whenever focus changes, not when the button is actually clicked (which is what happens with UIButton).

This is true if you put them side-by-side. However, if you stack them all in a column then they work like UISwitches.


-Brian

How do you stack them in a column or do you mean using 2 segmented button and have 1 segment for each of them?

I wish I could post screenshots. Basically I have a Settings dialog in my app that uses a bunch of yes/no switches. I put all the options in a column from top to bottom: MUSIC: ON/OFF, REDUCE MOTION: ON/OFF, etc. All of the ON/OFF switches are done as UISegmentedControllers, but the catch is that you can't move focus horizontally with those, or it changes the switch's on/off value. But, you can move up and down, so I simply put all those settings in a column so the user only has to move up/down to select the setting that they want to change.


-Brian

This sound like a pretty neat trick. Can you share the screenshot with me through a dropbox link or something?

UISwitch in tvOS
 
 
Q