I have tableview with custom cells with multiple sections. There are multiple rows in every section. Each row contains one label and one button(radio). I have created IBOutlet action of the button. My requirement is to select only one label in each section. To resolve this I have implemented below code. Another issue is that if I select one radio button and scroll to another section, the radio button should be shown as selected. How to resolve this issue, please tell me.
let position: CGPoint = sender.convertPoint(CGPointZero, toView: table_view)
if let indexPath = table_view.indexPathForRowAtPoint(position)
{
let cell = (table_view.cellForRowAtIndexPath(indexPath)! as! PartCell)
let Section_count = table_view.numberOfSections
let rowCount = table_view.numberOfRowsInSection(indexPath.section)
for j in 0..<Section_count
{
if j==indexPath.section
{
for i in 0..<rowCount
{
if i==indexPath.row
{
cell.btn_radio.selected=true
}
else
{
cell.btn_radio.selected=false
}
}
}
}