Я разрабатываю приложение для iPhone.Пользовательский UIView выбрасывает EXC_BAD_ACCESS на [super dealloc]
У меня есть класс, который наследует от UIView. Он имеет способ добавить два UILabels и один UIImageView в качестве подзонов класса. UILabels и UIImageView создаются и уничтожаются по этому методу.
Когда я освобождаю этот пользовательский класс, он прерывается при вызове [super dealloc] по его методу dealloc.
отладчик показывает это: alt text http://img339.imageshack.us/img339/3157/capturadepantalla201006s.png
Существует что-то связано с UILabel dealloc или удалением его из надтаблицы.
Если я прокомментирую [super dealloc]
, ошибок не возникает.
Любые советы?
UPDATE
- (void)dealloc {
[super dealloc];
}
- (void)drawView:(ARCoordinate *)coordinate {
UILabel *titleLabel = [[UILabel alloc] initWithFrame:CGRectMake(0, 0, BOX_WIDTH, 20.0)];
[titleLabel setBackgroundColor: [UIColor colorWithWhite:.3 alpha:.8]];
[titleLabel setTextColor: [UIColor whiteColor]];
[titleLabel setTextAlignment: UITextAlignmentCenter];
[titleLabel setText: [coordinate title]];
[titleLabel sizeToFit];
[titleLabel setFrame: CGRectMake(BOX_WIDTH/2.0 - [titleLabel bounds].size.width/2.0 - 4.0,
0,
[titleLabel bounds].size.width + 8.0,
[titleLabel bounds].size.height + 8.0)];
UILabel *subTitleLabel = [[UILabel alloc] initWithFrame:CGRectMake(0, 0, BOX_WIDTH, 20.0)];
[subTitleLabel setBackgroundColor: [UIColor colorWithWhite:.3 alpha:.8]];
[subTitleLabel setTextColor: [UIColor whiteColor]];
[subTitleLabel setTextAlignment: UITextAlignmentCenter];
[subTitleLabel setText: [coordinate subtitle]];
[subTitleLabel sizeToFit];
[subTitleLabel setFrame: CGRectMake(BOX_WIDTH/2.0 - [subTitleLabel bounds].size.width/2.0 - 4.0,
21.0,
[subTitleLabel bounds].size.width + 8.0,
[subTitleLabel bounds].size.height + 8.0)];
UIImageView *pointView = [[UIImageView alloc] initWithFrame:CGRectZero];
[pointView setImage: [UIImage imageNamed:@"location.png"]];
[pointView setFrame: CGRectMake((int)(BOX_WIDTH/2.0 - [pointView image].size.width/2.0), (int)(BOX_HEIGHT/2.0 - [pointView image].size.height/2.0), [pointView image].size.width, [pointView image].size.height)];
[self addSubview:titleLabel];
[self addSubview:subTitleLabel];
[self addSubview:pointView];
[self setBackgroundColor:[UIColor clearColor]];
[titleLabel release];
[subTitleLabel release];
[pointView release];
}
Если вы показываете код, было бы намного проще помочь ;-) – Eiko
Является ли [super dealloc] самой первой строкой в вашем методе dealloc? – ennuikiller
Я добавил исходный код. Сожалею. – VansFannel