在模態視圖中,我有一個在viewDidLoad
中分配並初始化的UIPickerView。去哪裏dealloc pickerview?
它被釋放在dealloc
與該視圖中使用的其他對象。
這是一個不正確的方式釋放我的選擇器?爲什麼在模態視圖被解散後需要訪問它,因爲錯誤信息似乎暗示着?
殭屍日誌錯誤是:
-[UIPickerView release]: message sent to deallocated instance 0x5a441
相關代碼:
- (void)viewDidLoad
{
[super viewDidLoad];
//navigation bar stuff here
mcPickerView = [[UIPickerView alloc] initWithFrame:CGRectMake(0, 244, 320, 216)];
mcPickerView.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleTopMargin;
// setup the data source and delegate for this picker
mcPickerDataSource = [[MCPickerDataSource alloc] init];
mcPickerView.dataSource = mcPickerDataSource;
mcPickerView.delegate = mcPickerDataSource;
mcPickerView.showsSelectionIndicator = YES;
[self.view addSubview:mcPickerView];
}
- (void)dealloc
{
[mc dealloc];
[mcPickerView dealloc];
[mcPickerDataSource dealloc];
[mcVal release];
[super dealloc];
}
請顯示您的代碼viewDidLoad和dealloc – jaminguy 2011-06-04 16:14:57
添加了相關的代碼 – Ayrad 2011-06-04 16:24:44