Should I use release or autorelease for varSecondViewController?
-(IBAction)takeNextStep: (id) sender { SecondViewController *varSecondViewController = [[SecondViewController alloc] initWithNibName:@"SecondViewController" bundle:nil]; [self.navigationController pushViewController:varSecondViewController animated:YES]; [varSecondViewController release]; }
My rule:
If you intend to use it, and then no longer need to reference it, release it,
If you transfer it back to the caller (i.e. return it), run it.
autorelease - release, , , . , , , - . , . release.
autorelease
release
In this case, it releasemakes the most sense.
Source: https://habr.com/ru/post/1774384/More articles:Как загрузить zip файл с помощью Java? - javaHow will the Samsung Galaxy Tab add-on be used to install / install my Android Market? - androidFrom C # - Is there a way to determine if swf is AVM1 or AVM2? - c #.NET ServerVariables ("AUTH_USER") and non-ASP page - javascriptNullable type padding from DataRow - vb.netSorting a 2-dimensional array - javaEntity Framework Update Error - c #Where is the object instance of my view model? - design-patternsIs there a way to overload / intercept function calls for overloaded objects in Perl? - functionHow to specify a composite key in the root code of Entity First - entity-framework-4All Articles