在模态视图中,我有一个在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