views:

48

answers:

3

Hi, I'm not using Autorelease. When I use like this code, I don't know How to release BSPTile

    NSUInteger numbToday = [[dateFormatter stringFromDate:[NSDate date]] intValue];
    BSPTileView *tile = [gridView.subviews objectAtIndex: 0];
    tile.comparedValue = 0;

BSPTileView is UIView Class. How to do ? please.

+1  A: 

You don't. You did not receive this pointer via a method call that contains new, alloc, retain, or copy, so you are not responsible for releasing (or autoreleasing) the pointer.

If your application is structure such that you have to release it here, then you've done something wrong somewhere else.

Dave DeLong
+1  A: 

In this case, you don't have to. -objectAtIndex: just returns the object at that index in the array, without changing its retain count.

Noah Witherspoon
A: 

If you have your BSPTileView inserted in a view hierarchy, the hierarchy takes care of managing the object for you. Taking the object from the subviews array does not change the retain count. No responsibility is transfered.

David