Iphone 表单元指示符问题
在我的应用程序中,我使用了Iphone 表单元指示符问题,iphone,objective-c,ios,uitableview,accessoryview,Iphone,Objective C,Ios,Uitableview,Accessoryview,在我的应用程序中,我使用了 [cell setAccessoryType:UITableViewCellAccessoryCheckmark]; 当我滚动这个表格时,我在多个单元格中得到多个复选标记 请帮助我。一般来说,该单元格有两种方式: - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { static NSString *ide
[cell setAccessoryType:UITableViewCellAccessoryCheckmark];
当我滚动这个表格时,我在多个单元格中得到多个复选标记
请帮助我。一般来说,该单元格有两种方式:
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
static NSString *identifier = @"Cell";
UITableViewCell *cell = ... // The cell come from reuse queue.
if (cell == nil) {
cell = ... // if reuse queue has no cell, then create an autoreleased cell
}
// Configure cell by indexPath.
// You should configure cell HERE.
}
因为您的单元可能来自重用队列,所以对其进行了配置。显然,您忘记了重新配置来自重用队列的单元 您可以在tableView的委托方法DidSelectedRowatineXpath上使用此示例代码 UITableViewCell*单元格=[tableView cellForRowAtIndexPath:indexPath]; [选定单元格设置:是动画:是]; [单元格设置访问类型:UITableViewCellAccessoryCheckmark]
for(int iterator=0;iterator<3;iterator++)
{
UITableViewCell *eachCell = [[self tableView] cellForRowAtIndexPath:[NSIndexPath indexPathForRow:iterator inSection:0]];
[eachCell setSelected:NO animated:YES];
[eachCell setAccessoryType:UITableViewCellAccessoryNone];
}
UITableViewCell *newCell = [tableView cellForRowAtIndexPath:indexPath];
[newCell setSelected:YES animated:YES];
[newCell setAccessoryType:UITableViewCellAccessoryCheckmark];
for(int iterator=0;iterator)您可以将代码发布到哪里,设置单元格附件视图以更好地理解代码。