次の変数をインスタンス変数として宣言し、m ファイルで使用していますが、警告が表示されます。
TransparentToolbar *tools;
オンラインで割り当てられたオブジェクトの潜在的なリーク ...
たとえば、そのためのプロパティを作成しようとしました..
@property (nonatomic, retain) TransparentToolbar *tools;
そしてそれを合成して解放しますが、私のビューはdeallocの最後にクラッシュします。
私は何を間違っていますか?
pickerSortingDataCurrent で同じ警告を編集します ...
h
@interface myViewController : UIViewController <UIActionSheetDelegate,
UIPickerViewDelegate, UIPickerViewDataSource, UITableViewDelegate,
UITableViewDataSource, MFMailComposeViewControllerDelegate> {
TransparentToolbar *tools;
NSArray *pickerSortingDataCurrent;
}
@property (nonatomic, retain) TransparentToolbar *tools;
@property (nonatomic, retain) NSArray *pickerSortingDataCurrent;
m
@synthesize pickerSortingDataCurrent;
@synthesize tools;
- (void)viewDidLoad {
[super viewDidLoad];
tools = [[[TransparentToolbar alloc]
initWithFrame:CGRectMake(0, 0, 70, 44.01)] autorelease];
tools.barStyle = UIBarStyleBlackOpaque;
self.pickerSortingDataCurrent = [[NSArray alloc] initWithObjects:
@"Next Date Ascending",
@"Next Date Descending", nil]; // removed some items here
}
- (void)dealloc {
[tools release];
[pickerSortingDataCurrent release];
[super dealloc];
}
ああ、私はオートリリースを持っています....しかし、それはpickerSortingDataCurrentを解決しません...
編集...
#import "TransparentToolbar.h"
@implementation TransparentToolbar
- (void)drawRect:(CGRect)rect {
// do nothing in here
}
- (void) applyTranslucentBackground
{
self.backgroundColor = [UIColor clearColor];
self.opaque = NO;
self.translucent = YES;
}
- (id) init
{
self = [super init];
[self applyTranslucentBackground];
return self;
}
// Override initWithFrame.
- (id) initWithFrame:(CGRect) frame
{
self = [super initWithFrame:frame];
[self applyTranslucentBackground];
return self;
}
@end
さらに編集