У меня есть метод, подобный следующему:
- (void)add:(id)sender {
MyAddViewController *controller = nil;
controller = [[MyAddViewController alloc] initWithAddType:1];
//controller.delegate = self;
// Do some animation. Slide it in from the right side of the screen.
CGPoint initialCenter = self.view.center;
controller.view.center =
CGPointMake(initialCenter.x + 320, initialCenter.y);
// Add the subview now with it's center + 320 off the screen.
[self.view addSubview:controller.view];
[UIView beginAnimations:@"animation" context:NULL];
[UIView setAnimationDuration:0.35];
[UIView setAnimationDelegate:self];
controller.view.center = CGPointMake(initialCenter.x, initialCenter.y);
//[UIView setAnimationDidStopSelector:@selector(aMethodToBeCalledAfterAnimationEnd:finished:context:)];
[UIView commitAnimations];
//[controller release];
}
Вы видите, что у меня релиз контроллера в качестве последней строки в моем методе добавления.Если я раскомментирую эту строку, анимация полностью умирает, и она просто сбрасывает представление на место без анимации.
Есть ли лучший способ сделать release без необходимости создания другого метода, выполняющего очисткучерез [UIView setAnimationDidStopSelect: @selector (aMethodToBeCalledAfterAnmiationEnd ... ?
Или я могу сделать что-то вроде setAnimationDidStopSelector: @selector ([выпуск контроллера]) :)
Заранее спасибо!