У меня есть UITableView с методом cellForRowAtIndexPath
, который создает UITextView, а затем добавляет его в ячейку. Не было обнаружено утечек памяти, но при запуске Instruments (Object Allocations) сетевая память отправляется в одностороннем порядке до 18 МБ, где она падает.
Мое приложение постоянно добавляет и удаляет ячейки в источнике данных tableView, но поскольку TextView выпущен, я не вижу способа накопления памяти.
Вот мой cellForRowAtIndexPath
код:
static NSString *cellIdentifier=@"Cell";
UITableViewCell *cell=[tableView dequeueReusableCellWithIdentifier:cellIdentifier];
if (cell==nil) {
// Build cell
cell=[[[UITableViewCell alloc] initWithFrame:CGRectZero reuseIdentifier:cellIdentifier] autorelease];
}
cell.selectionStyle=UITableViewCellSelectionStyleNone;
UITextView *tv=[[UITextView alloc] initWithFrame:CGRectMake(0, 0, 320, 95)];
tv.font=[UIFont fontWithName:@"Helvetica-Bold" size:16];
tv.text=@"My Cell Text";
[cell addSubview:tv];
[tv release];
return cell;
Заранее спасибо!