Okan
Okan

Reputation: 1389

Using switches inside static tableview

I have a static tableview for settings. I have switches inside this tableview. But I don't know how to access to switches from code. I mean how can I get the switch on/off status in code ?

View:

enter image description here

I have one view controller for settings but I couldn't drag from switches to view controller. I guess i have to drag to tableview controller. But I don't know how to do this. Can somebody show me a roadmap for this operation ?

This is my storyboard:

enter image description here

Upvotes: 0

Views: 162

Answers (2)

4esterUA
4esterUA

Reputation: 284

You can link outlets only with class, which is set as parent in storyboard. So you should create new class MyTableViewController, set it as parent for your storyboard TableViewController and after that you'll be able to drag your switches and connect them.

Upvotes: 1

bgilham
bgilham

Reputation: 5949

Add an IBOutlet to each switch and check the isOn property.

Upvotes: 2

Related Questions