【发布时间】:2011-01-22 14:56:58
【问题描述】:
伙计们。我是 iphone 新手。 我遇到了一个问题。uiimageview 无法释放...这是代码。
#import <UIKit/UIKit.h>
@interface imageNavView : UIImageView {
int index;
}
@property int index;
@end
#import "imageNavView.h"
@implementation imageNavView
@synthesize index;
- (id)initWithFrame:(CGRect)frameRect{
self = [super initWithFrame:frameRect];
if (self) {
// Custom initialization.
self.userInteractionEnabled=YES;
self.multipleTouchEnabled=YES;
self.opaque=YES;
self.autoresizingMask=(UIViewAutoresizingFlexibleHeight|
UIViewAutoresizingFlexibleWidth|
UIViewAutoresizingFlexibleRightMargin
|UIViewAutoresizingFlexibleLeftMargin
|UIViewAutoresizingFlexibleTopMargin
|UIViewAutoresizingFlexibleBottomMargin);
index=0;
}
return self;
}
- (void)dealloc {
NSLog(@"before image dealloc %i",[self retainCount]);-------- log is 1
[super dealloc];
NSLog(@"after image dealloc %i",[self retainCount]);-------- log is 1,why itn't bad access?
}
@end
为什么第二个日志 NSLog(@"after image dealloc %i",[self retainCount]);是 1,不是一个坏访问,所以 imageview 没有被释放。 我不明白,任何可能的方式可以做到这一点?...任何建议将不胜感激。提前谢谢!
【问题讨论】:
标签: iphone objective-c uiimageview release