没有调用视图控制器的dealloc?

时间:2012-05-31 15:48:16

标签: iphone viewcontroller dealloc

我不知道为什么viewcontroller的dealloc没有调用

请参阅代码段。

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
    [tableView deselectRowAtIndexPath:indexPath animated:YES];

    SaleItemsVC *itemsObj = [[SaleItemsVC alloc] initWithNibName:@"SaleItemsVC" bundle:nil];
    [self.navigationController pushViewController:itemsObj animated:YES];

    EventSingleEntity *entityobj=(EventSingleEntity*)[arrSales objectAtIndex:indexPath.row];

    itemsObj.eveintEntityRef=entityobj;
    [itemsObj loadProductsOfEventId:entityobj.event_id];
    itemsObj.EventTitle.text=entityobj.name;
    itemsObj.EventEndDate.text=entityobj.end;
    SalesCell *cell=(SalesCell*)[tableView cellForRowAtIndexPath:indexPath];
    itemsObj.eventImage=cell.imgCenter.image;
    [itemsObj release];


}

1 个答案:

答案 0 :(得分:1)

你创建了itemsObj,控制器,所以ref count == 1

您将itemsObj推送到self.navigationController,refcount == 2

您释放itemsObj ref count == 1

在self.navigationController释放它之前不应该发布它。