У меня есть MapView в UIViewController. Когда я пытаюсь загрузить представление после его viewDidUnload, оно вылетает с этим сообщением:
-[Выпуск CALayer]: сообщение отправлено освобожденному экземпляру 0x29aea0
Я думаю, что делаю все необходимые вещи, которые я должен сделать в viewDidUnload:
- (void)viewDidUnload {
[super viewDidUnload];
locationManager.delegate = nil;
[locationManager release];
locationManager = nil;
mapView.delegate = nil;
[mapView release];
mapView = nil;
}
Мой MapView находится в UIView, настроенном в xib-файле. Мой ВК никогда не освобождается.
Я уже некоторое время гуглю, но не могу найти ответ.
Изменить
- (void)viewDidLoad {
[super viewDidLoad];
locationManager = [[CLLocationManager alloc] init];
[locationManager setDelegate:self];
[locationManager setDesiredAccuracy:kCLLocationAccuracyBest];
[locationManager startUpdatingLocation];
[label setFont:[UIFont fontWithName:@"Sansation" size:28]];
[label setShadowOffset:CGSizeMake(0, 1)];
[label setShadowColor:[UIColor grayColor]];
self.navigationItem.titleView = labelView;
[label release];
[labelView release];
UIBarButtonItem *checkInButton = [[UIBarButtonItem alloc] initWithTitle:@"Checka In" style:UIBarButtonItemStylePlain target:self action:@selector(checkIn)];
[[self navigationItem] setRightBarButtonItem:checkInButton];
[checkInButton release];
UIBarButtonItem *clueListButton = [[UIBarButtonItem alloc] initWithTitle:@"Ledtrådar" style:UIBarButtonItemStylePlain target:self action:@selector(cluesDown)];
[[self navigationItem] setLeftBarButtonItem:clueListButton];
[clueListButton release];
UINavigationBar *bar = [self.navigationController navigationBar];
[bar setTintColor:[UIColor colorWithRed:0.06 green:0.58 blue:0.88 alpha:1]];
}
«labelView» и «label» — это IBOutlets.
[super viewDidUnload];
может их освободить, а ваше освобождение приведет к сбою. - person DarkDust   schedule 02.05.2011viewDidUnload
вызывается, когда контроллер представления освобождает свои представления (очистка). - person DarkDust   schedule 02.05.2011