guys.i'm new to iphone。 我遇到一个问题。uiimageview无法发布...这里是代码。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不会被释放。 我不明白,任何可能的方式可以做到这一点?...任何意见将gratefull.thanks提前!
我觉得编译器甚至应该发出警告调用它。 – 2011-01-22 21:06:57