My UITableView crashes when scrolling and
dequeueReusableCellWithIdentifier:
is called, during the _second time_ - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
is called ( to re-use the cell, after creation ). I was getting a
EXEC_BAD_ACCESS
at dequeueReusableCellWithIdentifier:
I realized that after initializing my custom UITableViewCell, I am setting
cell = [myCustomCell autorelease]
when I should be using cell = [myCustomCell retain]
.after customizing a UITableViewCell, call retain, not autorelease, before returning it from tableView:cellForRowAtIndexPath. I'll also mention that I am initializing my custom cell from a nib file by using
[[NSBundle mainBundle] loadNibNamed:@"MyCustomCell" owner:self options:nil];