【发布时间】:2010-12-02 04:47:29
【问题描述】:
当自动释放字符串分配给 IBOutlet 属性时,它会被保留吗?比如说我有一个财产
@property(nonatomic, retain) IBOutlet UILabel *lblName;
现在在我的viewWillAppear 中,我将lblName 分配为:
lblName = [NSString stringWithFormat: @"NameString"];
那么这个字符串的保留计数是多少,我是否需要确保在每次添加视图或调用viewWillAppear 时分配一个新字符串之前分配lblName = nil;。
还有一个问题是关于UIImageView
@property(nonatomic, retain) IBOutlet UIImageView *imgView;
现在当我使用动画时
NSMutableArray *imageArray = [[NSMutableArray alloc] init];
//some images are added to imageArray
imgView.animationImages = imageArray //NSMutableArray of autoreleased images.
[imageArray release];
是保留该数组中的图像还是保留该数组,因为imgView 具有保留属性。
【问题讨论】:
标签: iphone objective-c cocoa-touch