こんにちは、UITableView と UISwitch に取り組んでいます。UISwitches を含むカスタム セルがあります。最初は UISwitch がオフで、オンにします。別のセルで UISwitch をオンにすると、最初にオンになっていた UISwitch がオフになるはずです。これを cellForRowAtIndexPath に実装しています。
特定の症状に対してremedyIDが選択されているかどうかを確認しています。それが選択されている場合は、スイッチをオンにして残りをオフにする必要があります。私はデータを公開しています。
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];
}
}
だから誰かが私を助けることができれば..それは素晴らしいだろう