我正在使用table将数组中的值设置为行中的标签。 在ios 10中,当我选择表行时,它可以工作,但在ios 11中,当我选择一行时,单元格标签值仅替换为Label文本。 任何人都可以帮忙。 这是我所做的代码:=
-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
return arrpickuprequest.count;
}
-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
cell.lblName.text = [[arrpickuprequest objectAtIndex:indexPath.row-1]valueForKey:@"Name"];
cell.btncheck.tag = indexPath.row;
if([[arrpickuprequestChecked objectAtIndex:indexPath.row] isEqualToString:@"Uncheck"])
[cell.btncheck setImage:[UIImage imageNamed:@"uncheck"] forState:UIControlStateNormal];
else
[cell.btncheck setImage:[UIImage imageNamed:@"check"] forState:UIControlStateNormal];
[cell.btncheck addTarget:self action:@selector(purchase_click:) forControlEvents:UIControlEventTouchUpInside];
cell.selectionStyle = UITableViewCellSelectionStyleNone;
return cell;
}
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
if (indexPath.row==0) {
if([[arrpickuprequestChecked objectAtIndex:indexPath.row] isEqualToString:@"Uncheck"])
{
for (int i=0; i<[arrpickuprequest count]+1; i++) {
[arrpickuprequestChecked replaceObjectAtIndex:i withObject:@"Check"];
}
}
else
{
for (int i=0; i<[arrpickuprequest count]+1; i++) {
[arrpickuprequestChecked replaceObjectAtIndex:i withObject:@"Uncheck"];
}
}
}
else {
if([[arrpickuprequestChecked objectAtIndex:indexPath.row] isEqualToString:@"Uncheck"])
{
[arrpickuprequestChecked replaceObjectAtIndex:indexPath.row withObject:@"Check"];
}
else
{
[arrpickuprequestChecked replaceObjectAtIndex:indexPath.row withObject:@"Uncheck"];
[arrpickuprequestChecked replaceObjectAtIndex:0 withObject:@"Uncheck"];
}
}
[tblPickupreuest reloadData];
}