【发布时间】:2012-02-28 14:12:38
【问题描述】:
我有一个 UITableView,其中一个 UISwitch 用于行。这样做:
UISwitch *switchController = [[UISwitch alloc] initWithFrame:CGRectZero];
if([valor isEqualToString:@"true"])
[switchController setOn:YES animated:YES];
else
[switchController setOn:NO animated:YES];
switchController.tag = row;
[switchController addTarget:self action:@selector(switchChanged:) forControlEvents:UIControlEventValueChanged];
cell.accessoryView = switchController;
[switchController release];
好的,我想要独占行,当我触摸一个 UISwitch 时,我需要将所有其他 UISwitch 设置为 OFF。 但我做不到...有人可以帮助我吗?
感谢朋友。
-(void) switchChanged:(id)sender{
UISwitch *switchController = sender;
}
【问题讨论】:
-
什么是 valor 是开关的一些信息吗?
-
将所有 valor 设置为 false 和 [table reloadData];
标签: iphone ios uitableview uiswitch