0
안녕하세요 그룹화 된 테이블보기를 사용하고 blueselection 스타일로 Tableview의 셀을 선택하고 있습니다.Tableview 셀 선택 문제
그러나 셀을 선택하고 다음보기로 돌아가서 다시 이전보기로 돌아 가면 셀이 여전히 선택되며 다른 셀을 선택하면 2 셀이 선택되어 표시됩니다.
내 코드에 아래의 이미지를 참조하십시오// Customize the appearance of table view cells.
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
static NSString *CellIdentifier = @"Cell";
JobViewTableCell *cell = (JobViewTableCell *)[tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil) {
if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad) {
[[NSBundle mainBundle] loadNibNamed:@"iPadJobViewCell" owner:self options:nil];
cell = self.JobViewcell;
}
else {
[[NSBundle mainBundle] loadNibNamed:@"JobViewTableCell" owner:self options:nil];
cell = self.JobViewcell;
}
}
[cell setJobID:[NSString stringWithFormat: @"%@",[(Jobs *)[tableArray objectAtIndex:indexPath.row]JobId]]];
[cell setJobTitle:[NSString stringWithFormat:@"%@",[(Jobs *)[tableArray objectAtIndex:indexPath.row]Title]]];
NSString *newDate =[NSString stringWithFormat:@"%@",[(Jobs *)[tableArray objectAtIndex:indexPath.row]Date]];
NSDateFormatter *dateFormat = [[NSDateFormatter alloc] init];
[dateFormat setDateFormat:@"MM/dd/yyyy h:mm:ss a"];
NSDate *myDate = [dateFormat dateFromString:newDate];
[dateFormat setDateFormat:@"MM/dd/yyyy"];
NSString *str = [dateFormat stringFromDate:myDate];
NSLog(@"%@",str);
[cell setJobDate:[NSString stringWithFormat:@"%@",str]];
[cell setLocation:[NSString stringWithFormat:@"%@",[(Jobs *)[tableArray objectAtIndex:indexPath.row]Location]]];
[dateFormat release];
return cell;
}
이있는 tableView의 didSelectRowAtIndexPath
방법
감사합니다 .. 그것을 제대로 작동하고있다. – iProgrammer