didReceiveMemoryWarning on modalViewController level
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
 加载中,请稍侯......
      
精彩评论