Giter Site home page Giter Site logo

Comments (6)

ChavezChen avatar ChavezChen commented on August 20, 2024

本质是present出来的。和正常present另一个界面是一样的,所以会走vc的所有生命周期函数。如果你不希望执行viewwillappear里面的部分代码,可以事先做一个标记让它不执行或者看能不能把代码搬迁到其他位置。

from cwlateralslide.

hugolubingshen avatar hugolubingshen commented on August 20, 2024

我知道是present的,但是侧边栏一启动,就是present后,开启的vc的viewwillappear就触发了,正常present是关闭之后,触发present的vc才会触发viewwillappear

from cwlateralslide.

ChavezChen avatar ChavezChen commented on August 20, 2024

你是说 当 A present B 的时候。A的viewwillappear方法也调用了是吗? 这个是因为在自定义转场结束的时候,调用[transitionContext completeTransition:YES];这个方法系统会把A的视图从containerView中移除掉,于是我在后面手动将 A的视图重新加到containerView中。。这样才能显示到界面上,于是addsubview:A.view]这一操作会造成A的viewwillappear方法调用。

from cwlateralslide.

hugolubingshen avatar hugolubingshen commented on August 20, 2024

对,就是这样,有办法解决吗?我现在需求是点解侧边栏切换模式,viewwillappear再重新加载数据,我不想触发两次viewwillappear

from cwlateralslide.

hugolubingshen avatar hugolubingshen commented on August 20, 2024

或者说,我在viewwillappear加个判断,我本地存储一个变量判断,但是怎么知道现在是关闭,还是开启呢?

from cwlateralslide.

ChavezChen avatar ChavezChen commented on August 20, 2024

show的时候 设置标记为YES,然后在viewwillAppear里面判断这个标记为YES,就将此标记设置为NO,同时return,不执行后面的代码。


- viewwillapear {
  [super ...];
  if (flag == YES) {
     flag = NO;
     return;
  }
}

from cwlateralslide.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.