私は以下の変数をインスタンス変数として宣言していますが、これを私のmファイルで使用していますが、警告が表示されています。Obj-C、行に割り当てられたオブジェクトの潜在的なリーク、警告?
TransparentToolbar *tools;
行に割り当てられたオブジェクトの
潜在的な漏れ...私は例えばそれのプロパティを作成しようとした「
..
@property (nonatomic, retain) TransparentToolbar *tools;
そしてsynthesize'ing、それを解放しますしかし、私の見解はdeallocの終わりにクラッシュします。
私は間違っていますか?
EDIT 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 ...
EDITを解決しません...
#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
さらに編集
。 – Max
'dealloc'コードを含めることができますか? – Jef
同じ問題が発生しました。私はviewDidLoadにデータを取り込み、上記の編集を参照してください。 – Jules