Do init* functions retain what is passed to them?
I init a navigation controller with:
UINavigationController *navController = [[UINavigationControlle开发者_StackOverflow中文版r alloc] initWithRootViewController:firstViewController];
I wonder if the navigation controller retains firstViewController or that I need to keep it alive. When I release firstViewController, the navigation controller still works. That seems wrong.
Clarifications?
If it needs to keep it around it will retain
it. So yeah, you'll be safe to release it if you don't need it anymore. It's not just initWhatever
methods that have this behaviour - it's the standard operation of the whole memory management model.
精彩评论