开发者

Presentmodalviewcontroller method problem with retain count

开发者 https://www.devze.com 2022-12-27 08:31 出处:网络
I am trying to 开发者_StackOverflowpresent a modal view controller. I have read the documentation, but something is strange. Here\'s my code:

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: 24

And 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?

0

精彩评论

暂无评论...
验证码 换一张
取 消