您好我正在使用UITableView和UISwitch。我有包含UISwitches的自定義單元格。在開始時,UISwitch關閉,我打開它。當我打開另一個單元中的UISwitch時,開始時打開的UISwitch應該關閉。我在cellForRowAtIndexPath中實現了這一點。如何禁用uitableview的自定義單元中的uiswitch
我在檢查是否針對特定症狀選擇了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];
}
}
所以,如果有人能幫助我..that將是巨大的
你用你發佈的代碼得到了什麼結果? – rdelmar
當我打開第二個uiswitch ..我得到一個alertview,當我點擊確定..第一個uiswitch沒有關閉。兩個開關保持打開。如果你想要,我可以郵寄你的.m文件.u會變得更好主意 –
這會有所幫助。您可以將它發送到[email protected] – rdelmar