After displaying and dismissing the Modal View Controller UIImagePickerController my Cocos2d iPhone app doesn't see multiple touches anymore

一曲冷凌霜 提交于 2019-12-06 07:23:05

After investigating the view hierarchy from the root window down I have found that after dismissing the Photo chooser that my viewController's view was getting added as a child under a UITransitionView so the solution is to remove the superview of my viewController's view instead:

- (void)imagePickerControllerDidCancel:(UIImagePickerController *)imagePickerController
{
    // Dismiss the image selection
    [pickerViewController dismissModalViewControllerAnimated:YES];
    [pickerViewController.view.superview removeFromSuperview];
}

I've noticed that CJ Hanson's solution works for me on iPhones:

[pickerViewController.view.superview removeFromSuperview];

but not on iPads. The normal way:

[pickerViewController.view removeFromSuperview];

works on the iPad. I just call both at the moment and it seems to work ok:

[pickerViewController.view removeFromSuperview];
[pickerViewController.view.superview removeFromSuperview];

Maybe someone with more knowledge can clarify why this is needed?

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!