I have a problem: I want to get indexPath of recent cell added on UITableView. Here is my code:
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
//[_tableView clearsContextBeforeDrawing];
static NSString *simpleTableIdentifier = @"SimpleTableItem";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:simpleTableIdentifier];
if (cell == nil) {
cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:simpleTableIdentifier];
}
cell.tag = indexPath.row;
CGRect frame1 = CGRectMake(10, 25, 80, 10);
UILabel *lbl2= [[UILabel alloc]initWithFrame:frame1];
[lbl2 setFont:[UIFont fontWithName:@"Helvetica" size:8.5]];
[lbl2 setTextColor:[UIColor blackColor]];
[lbl2 setTextAlignment:UITextAlignmentLeft];
lbl2.text = [FileDateArray objectAtIndex:indexPath.row];
[cell addSubview:lbl2];
[lbl2 release];
deleteIndexPath = indexPath.row;
NSLog(@"Delete index:%@",deleteIndexPath);
return cell;
}
On my tableview only one row added a time. When I print on console, deleteIndexPath is null. Do you have any suggestion?