Home  >  Q&A  >  body text

objective-c - whose view is not in the window hierarchy! IOS

1.现在遇到的问题是这样子: 工程里有 A B C 三个页面。
A present B页面,B push 到C 页面。
C 页面里有一个UIwebView ,加载了H5页面, H5页面有个按钮调用手机的相册 UIImagePickerController,弹出了拍照,相册选择的UIActionSheet, 然后我点击相册按钮,程序直接退出到了 A 页面。

2.我尝试用A push 到B 页面,B页面push 到C 页面,这样子的话,在点击相册后会到系统相册里面,选择图片后会返回到H5页面里。

3.我现在需要的是present 也能实现而不是用push。 我认为是根控制器的原因。因为C 这个页面是H5去实现的,所以我能做什么?


我尝试了以下方案,

发现只要有present ,就是出现问题,而且提示问题就出现在present 那里

某草草某草草2751 days ago708

reply all(4)I'll reply

  • phpcn_u1582

    phpcn_u15822017-05-02 09:22:08

    There is a solution you can try: put B and C in a UINavigationController for management, and use A to present the UINavigationController.

    reply
    0
  • 天蓬老师

    天蓬老师2017-05-02 09:22:08

    If this is to be implemented correctly, A present B page should present not B, but the navigationController with B as the root.

    UINavigationController *navigationController = [[UINavigationController alloc] initWithRootViewController:BController];
    [self presentViewController:navigationController animated:YES completion:nil];

    reply
    0
  • 怪我咯

    怪我咯2017-05-02 09:22:08

    Write a solution to this, but I don’t know if there is any problem. This is how I solved it so far.
    I guess it’s a problem with the root controller. Then now it’s time to change the root controller

    Just modify window.rootviewcontroller, jump to present C and change window.rootviewcontroller
    When C returns, change window.rootviewcontroller and change it back.

    reply
    0
  • 滿天的星座

    滿天的星座2017-05-02 09:22:08

    Solution
    http://www.skyfox.org/present...

    reply
    0
  • Cancelreply