Within tableView:cellForRowAtIndexPath:
// Make a cell:
UITableViewCell *cell = [[[UITableViewCell alloc] initWithFrame:CGRectZero reuseIdentifier:@"Default"] autorelease];
// Make a spinner:
UIActivityIndicatorView *spin = [[UIActivityIndicatorView alloc] initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleGray];
// [spin retainCount] = 1
// Start spinning
[spin startAnimating];
[cell.contentView insertSubview:spin atIndex:0];
// [spin retainCount] = 3. Huh?
// I would have expected it to be 2 at this point.
[spin release];
// [[cell.contentView.subviews objectAtIndex:0] retainCount] = 2
At this point I would have thought cell.contentView.subview is the sole object with a retain on the spinner. But clearly a retain count of 2 indicates that something else is also retaining it. Could someone please explain to me who the mystery object is that has a retain on the spinner besides cell.contentView's subview array?
Cheers,
Doug