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