0
我是新手,因此對於以下問題的任何建議都將不勝感激。在Core Data數據應用程序中更新和保存在UITableView中顯示的多個UISlider值
我有一個應用程序,您可以在其中輸入許多項目,然後在後續的tableview中,它們將全部加載,並且我可以使用uislider爲每個項目分配一個值。
我知道如何跟蹤和保存值,如果我知道確切的項目數量,但我已經跟蹤的uislider值的數量取決於輸入的項目數量,我不確定在哪裏走。
到目前爲止,在我的sliderValueChanged方法,我有一個讓我跟蹤每個uislider子視圖如下:
- (IBAction)sliderChangedValues:(id)sender {
UISlider *slider = (UISlider *)sender;
CGPoint correctedPoint =
[slider convertPoint:slider.bounds.origin toView:self.tableView];
NSIndexPath *indexPath =
[self.tableView indexPathForRowAtPoint:correctedPoint];
NSLog(@"Using slider in row %d", indexPath.row);
}
這裏是我的裝載電池的cellForRowAtIndexPath方法:
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath: (NSIndexPath *)indexPath {
Criteria *myCriteria = [criteriasRankingArray objectAtIndex:indexPath.row];
static NSString *CellIdentifier = @"CriteriaRankingCell";
OptionsDetailViewCell *cell = (OptionsDetailViewCell *)[tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil) {
[self.cellNib instantiateWithOwner:self options:nil];
cell = optionsCell;
self.optionsCell = nil;
}
cell.criteriaRankSlider.minimumValue = 1.00;
cell.criteriaRankSlider.maximumValue = [criteriasRankingArray count];
cell.criteriaRankSlider.continuous = YES;
cell.criteriaNameLabel.text = [NSString stringWithFormat:@"%@", myCriteria.criteriaName];
cell.criteriaRankSlider.value = [myCriteria.criteriaRank floatValue];
return cell;
}
怎麼辦我會跟蹤每個值,然後在哪裏設置每個滑塊值並保存到上下文中?
謝謝!那就是訣竅。 – hafizito