我有一个UITableView
用custom cell
. 每个自定义单元格中都有一个 UISwitch,就像 iPhone 中的闹钟应用程序一样。UISwitch
我想在我的UITableView
细胞中启用每一个。请帮我 ...
问问题
123 次
2 回答
0
我找到了我的答案:
MyTableView.allowsSelection=NO;
MyTableView.allowsSelectionDuringEditing=YES;
这部作品非常好...
于 2013-01-05T14:57:27.237 回答
0
这段代码不是通用的,你应该重构它,但这是主要思想。
- (void)enableOnlyAllTheSwitches{
int objectsCount = [myObjectsDataStructure count];
for (int i=0; i++; i<objectsCount){
NSIndexPath *cellIndexPath = [NSIndexPath indexPathForRow:i inSection:0];
MyCustomTableViewCell *cell = [self.myTableView cellForRowAtIndexPath:cellIndexPath];
[cell.switch setOn:YES animated:YES];
}
}
于 2013-01-04T10:25:45.210 回答