Home  >  Q&A  >  body text

xcode - iOS UINavagationBar 隐藏显示应该写在哪里?

我出现的问题是:
rootViewController的navigationBar hide = yes,然后push到下一个页面时显示 navigationbar,都写在willApear 和 willDisAppear里,但是有一定的概率会变成rootViewController的naviagationBar加载push出的那个页面里.
一般来说,对于这种不断显示隐藏navigationBar的操作,写在哪里比较好

PHP中文网PHP中文网2741 days ago274

reply all(2)I'll reply

  • 黄舟

    黄舟2017-04-18 09:33:21

    You may have done some time-consuming operation on the navigationBar. It stands to reason that they all use the same naviBar, just set it as hidden or not

    reply
    0
  • 黄舟

    黄舟2017-04-18 09:33:21

    Generally, it depends on whether there is more hidden or more displayed content in the application. I usually write the one with more content in rootViewController, and the other one is also in viewwillappear and disAppear. I have never encountered the kind of problem you mentioned. Please check carefully. Is the code stuck on the main thread due to some time-consuming operation during the loading process? According to the execution order, there is no problem.

    reply
    0
  • Cancelreply