Access switch and textfield in tableview from another method
I'm having a tableview with a couple of cells with 4 uiswitches and开发者_开发问答 one textfield inside. Simple question. I need a way to read all the positions of the switches and the string inside the textview by clicking a button. Tableview, textfield, switches and button is working fine. Just need to access the values of the switches and textfield from another method. By tagging the switches or something.
So how can I access the values from another method. Something like in tableview method:
...
UISwitch *switchView = [[option1 alloc] initWithFrame:CGRectZero];
switchView.tag = 3000;
cell.accessoryView = switchView;
...
And something like this in the button method:
...
BOOL status = [self.view viewWithTag:3000].on; //*Not a working method*
You are in the same class, nop ?
So maybe you could put your switch & co as class variable (declared in the header file). It would be easier ^^
精彩评论