Sehen Sie sich meinen Code unten, bekomme ich Speicherfehler, nachdem ich auf "Zurück" -Button klicken, wird das Problem behoben, wenn ich löschte [aboutView release] Warum ist das? und wie sollte ich aboutView veröffentlichen?UIViewController Animation Speicherfreigabe
-(IBAction)swichView {
AboutView *aboutView = [[AboutView alloc] init];
[aboutView.view setAlpha:0];
[self.view addSubview:aboutView.view];
[UIView beginAnimations:@"" context:nil];
[UIView setAnimationDuration:1.0];
[aboutView.view setAlpha:1];
[UIView commitAnimations];
[aboutView release];
}
zweiten View Contorller:
-(IBAction)back {
[UIView beginAnimations:@"" context:nil];
[UIView setAnimationDuration:1.0];
[self.view setAlpha:0];
[UIView commitAnimations];
[self.view removeFromSuperview];
}
Gibt es einen Grund, warum Sie 'aboutView.view' anstatt' aboutView' selbst hinzufügen? Der Grund für den Absturz ist, dass 'aboutView' nicht beibehalten wird. –