I am programming my first iPhone app (which crashes with an EXC BAD ACCESS error).
I've read a few other similar answers, but still don't have a clear picture of how to fix my code.
Can someone help fix my memory management for the UITableViewCell *cell object in this snippet:
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
UITableViewCell *cell = [self.tableView dequeueReusableCellWithIdentifier:kCityCellReuseID];
if (cell == nil)
{
cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:kCityCellReuseID];
cell.selectionStyle = UITableViewCellSelectionStyleBlue;
cell.textLabel.text = [[self.myData objectAtIndex:indexPath.section] valueForKey:kDisplayText];
[cell release];
}
return cell;
}