Presentmodalviewcontroller method problem with retain count
I am trying to 开发者_StackOverflowpresent a modal view controller. I have read the documentation, but something is strange. Here's my code:
NSLog(@"rc: %d", [modalViewController retainCount]);
UINavigationController *navigationController = [[UINavigationController alloc] initWithRootViewController:modalViewController];
[self presentModalViewController:navigationController animated:YES];
[navigationController release];
NSLog(@"rc: %d", [modalViewController retainCount]);
And on the console, appears:
rc: 2
rc: 24And I think 24 is very strange... What do you thin? Why is this happening?
You shouldn't worry about the value of retain count too much. When using system calls like this, any number of retain/release cycles can occur.
If your view controller is being presented modally correctly, then what's the problem?
精彩评论