开发者

didReceiveMemoryWarning on modalViewController level

开发者 https://www.devze.com 2023-04-12 03:14 出处:网络
I\'m building an application with UITabBarController on top level, owner of 3 viewControllers - one UIViewController and two UINavigationController.

I'm building an application with UITabBarController on top level, owner of 3 viewControllers - one UIViewController and two UINavigationController.

One of the UINavigationController is working as follows:

UINavigationController -> pushViewContro开发者_运维知识库ller -> tapping on camera icon open the UIImagePickerControllerSourceTypeCamera using the [self presentModalViewController:imagePicker animated:YES];

Now -

I'm currently editing the didReceiveMemoryWarning method for all views and I'm wondering regarding an edge scenario related to the flow above.

If I receive a memory warning while the camera is in used (i.e. the ModalViewController is active), is the following method is the right way to handle memory warning?

if (self.modalViewController.retainCount)
{
    [self dismissModalViewControllerAnimated:NO];
    [self.modalViewController release];
}

It seems that it works fine when I'm testing the memory warning on my device but I just want to be sure that I did the right thing, best on your best practice.

Many thanks,

Dudi Shani-Gabay

0

精彩评论

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