什麼我有是如何單擊行後更改的UILabel的價值
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
static NSString *CellIdentifier = @"Cell";
cell = (CustomCell *)[tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil) {
[[NSBundle mainBundle] loadNibNamed:@"CustomCell" owner:self options:nil];
cell = customCell;
self.customCell = nil;
}
// Configure the cell.
switch (indexPath.row) {
case 0:
cell.title.text = @"iPhone!";
cell.date.text = @"December 25, 2009";
cell.imageView.image = [UIImage imageNamed:@"iphone.png"];
break;
case 1:
cell.title.text = @"Second Cell";
cell.date.text = @"December 26, 2009";
//Put in your own image. Make sure it is 120 by 100
cell.imageView.image = [UIImage imageNamed:@""];
break;
default:
break;
}
return cell;
}
// Override to support row selection in the table view.
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
NSLog(@"index %d",indexPath.row);
NSIndexPath *index = [NSIndexPath indexPathForRow:indexPath.row inSection: 0];
NSArray *array = [NSArray arrayWithObject: index];
cell.title.text = @"tetete";
[self.myTable reloadRowsAtIndexPaths: array withRowAnimation: UITableViewRowAnimationFade];
}
,如果你點擊一排我的目的是,你會改變該行的標籤的文本。
然而,reloadRowsAtIndexPath將調用cellForRowAtIndex而這一次它將舊的文本分配到的UILabel
我的問題:我應該怎麼改變,這樣我可以在該行點擊後更改的UILabel的價值