开发者

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 ^^

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜