I'm looking for a checkbox component in Swift. UISwitch seems not so handy because there I found no way to define a label for it.
Very good I find the component the iPhone used when turning on and off the personal hotspot. But I do not know what it is?

- 2,035
- 5
- 36
- 55
-
It's a custom `UITableViewCell`, with a `UISwitch`. – Sweeper Oct 11 '17 at 06:41
-
1It is related to the iOS, not the Swift programming language itself. – Ahmad F Oct 11 '17 at 06:48
-
2Why not use a UIButton with check image? – Puneet Sharma Oct 11 '17 at 06:49
3 Answers
There's no native radio button in iOS. As you can see in iOS, Apple uses UISwitch
as mention by Sweeper.
Now if you aim to achieve something like this, then you can make your own control or use some 3rd party open source libraries like VKCheckBox
. https://github.com/vladislav-k/VKCheckbox
I've been using this custom control and you can integrate it by either Cocoapods
or by merely importing its one and only class to your project.

- 12,555
- 6
- 54
- 95
-
Using UITableViewCell and UISwitch sounds interesting. Can you give a small example of how I have to proceed? – altralaser Oct 11 '17 at 07:32
No, there is no checkbox control available on iOS but i was achieve it using CZPicker view, it's allows to select single and multiple options from list
Please check this URL : https://github.com/chenzeyu/CZPicker
Thanks

- 21
- 5
I have cerated checkbox with uibutton subclass -- using image and title both and adjsuting title and image with title offset and image offset.
- Put a property isSelected -- On DidSet I change the image of button for select/unselect. 2.On click of button I toggle the property isSelected
- On click button I triger a delegate call back for get buttons selected/unselect state in view controller.
Hope It will help.

- 761
- 1
- 6
- 21
-
First of all - thanks for your good idea. The problem is that the app should be accessible for screenreader users and that's why I can't use an UIButton with image or custom style because the screenreader give no feecback in this case. – altralaser Oct 11 '17 at 08:51