0

I have a button in UITableViewHeaderFooterView and under this tableview, I have a few sub buttons as shown as below:-

enter image description here

How can I select sub button as well when I click on main button?

My current code as below:-

- (void)clipButtonClick:(UIButton *)button
{
    button.selected = !button.selected;
    if (button.selected) {

        for (int i = 0; i <_sectionItems.count; i ++)
        {
            subCell.btnClipCategory.selected = YES;
        }
    }
}
Kazunori Takaishi
  • 2,268
  • 1
  • 15
  • 27
Test 87
  • 101
  • 2
  • 10
  • You should use array of table to update selection status of button, using boolean value. It would be much better option. On button (clip) click, update your array and reload. – iOS May 24 '18 at 14:44
  • Need more info on this, what is subCell ? – ovidiur May 24 '18 at 14:45
  • Hi Ovidiur, subcell is tableview cell in my code (example :- Bistro and sub, catering service) – Test 87 May 24 '18 at 15:49
  • In the for loop, how you are accessing subcell., I mean its not dependents on the index 'i'. You are always accessing same subcell. Better you can reload that section and in CellForRow method manipulate the selection – Christeena John May 24 '18 at 16:22

0 Answers0