Handling multiple UISwitch controls in a table view without using tag property
        Posted  
        
            by Thaurin
        on Stack Overflow
        
        See other posts from Stack Overflow
        
            or by Thaurin
        
        
        
        Published on 2010-04-01T10:34:34Z
        Indexed on 
            2010/04/01
            21:53 UTC
        
        
        Read the original article
        Hit count: 547
        
I have a table view controller with multiple UISwitch controls in them. I set the delegate to the table view controller with the same action for all switches. I need to be able to determine what switch was changed, so I create an array of strings that contains the name of each switch. The indexes in the array will be put in the tag property of each UISwitch.
However, I'm ready using the tag property for something else, namely to find the right control in the cell in cellForRowAtIndexPath with viewWithTag! (There are several things I need to set within each cell.)
So, am I thinking along the right lines here? I feel I'm rather limited in how I find out exactly which UISwitch changed its value, so I can do something useful with it.
© Stack Overflow or respective owner