【发布时间】:2013-01-04 18:36:00
【问题描述】:
您好,我正在开发 UITableView 和 UISwitch。我有包含 UISwitches 的自定义单元格。一开始 UISwitch 是关闭的,我打开它。当我在另一个单元格中打开 UISwitch 时,一开始打开的 UISwitch 应该关闭。我在 cellForRowAtIndexPath 中实现这个。
我正在检查是否针对特定症状选择了remediateID。如果选择打开,则应关闭休息。我什至在重新引导数据。
cell.remedyID=[[[remedyArray objectAtIndex:indexPath.row]
objectForKey:@"RemedyID"]intValue];
cell.symptomIDNo =[[[remedyArray objectAtIndex:indexPath.row]
objectForKey:@"SymptomID"]intValue];
int checkValue = [[activeNotificationDictionary objectForKey:
[[remedyArray objectAtIndex:indexPath.row]
objectForKey:@"SymptomID"]]intValue];
if (cell.remedyID == checkValue){
objdb.notifyMe.on = YES;
} else {
objdb.notifyMe.on = NO;
}
- (void)alertView:(UIAlertView *)alertView didDismissWithButtonIndex:(NSInteger)buttonIndex{
if (buttonIndex != [alertView cancelButtonIndex]){
[activeNotificationDictionary setObject:
[NSNumber numberWithInt:selectedRemedyID] forKey:
[NSNumber numberWithInt:iPath]];
[remedyTableView reloadData];
}
}
所以如果有人可以帮助我..那就太好了
【问题讨论】:
-
您发布的代码有什么结果?
-
当我打开第二个 uiswitch 时..当我点击 OK 时我得到一个 alertview ..第一个 uiswitch 没有关闭。两个开关保持打开。如果你愿意,我可以给你邮寄 .m 文件。你会得到更好的主意
-
那会很有帮助。您可以将其发送至 rdelmar@comcast.net
标签: iphone ios objective-c uitableview uiswitch