我的主要问题是当它在里面的单元被重用时,保持UISegmentedControl的选定值。 当我滚动时,重用的单元格对于分段控件仍然具有相同的值。单元格重用时,如何将UISegmentedControl的选定段保留在UITableView中?
- (UITableViewCell *)tableView:(UITableView *)thisTableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
static NSString *CellIdentifier = @"yesNoCell";
testCell = [thisTableView dequeueReusableCellWithIdentifier:CellIdentifier forIndexPath:indexPath];
// Configure the cell...
testCell.mainText.text = [ questionArray objectAtIndex:indexPath.row];
[testCell.mainControl setFrame:CGRectMake(690, 22, 334, 40)];
return testCell;
}
编辑澄清: 我想保持选择的每一行。例如,我可能有10个可见行和30行。当我在第3行中选择一个段时,当“3”消失时显示的行具有相同的选定段。我想确保只有选定段的行是用户实际更改的行。
请详细说明您的问题。你想保留选择还是改变它? – Suhas
我想保留每行的选择。例如,我可能有10个可见行和30行。当我在第3行中选择一个段时,当“3”消失时显示的行具有相同的选定段。我想确保只有选定段的行是用户实际更改的行。 –
分段控制的内容是否会改变或对于所有单元格是否相同? – Suhas