0
你好我正在使用分組表格視圖並選擇Tableview的單元格與blueselection樣式。Tableview單元格選擇問題
但當選擇單元格,然後轉到下一個視圖,並再次回到以前的觀點細胞仍處於選中狀態,如果我選擇是顯示選擇2cells另一個單元。
看到的圖像與下面在我的代碼:
// 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;
}
請幫助
謝謝..它工作正常 – iProgrammer