首页 > 代码库 > ios Presenting view controllers on detached view controllers is discouraged <BasicInfoVC: 0x7fb2dc24

ios Presenting view controllers on detached view controllers is discouraged <BasicInfoVC: 0x7fb2dc24

出现的原因:

  在控制器A中添加控制器B--[A.view addSubView: B.view]

  在控制器B中弹出新的控制器时报此waring

解决:

[A addChildViewController:B];

[B.parentViewController presentViewController:alertController animated:YES completion:nil];

 

详见:http://stackoverflow.com/questions/19890761/warning-presenting-view-controllers-on-detached-view-controllers-is-discourage

ios Presenting view controllers on detached view controllers is discouraged <BasicInfoVC: 0x7fb2dc24