Giter VIP home page Giter VIP logo

Comments (4)

kingsic avatar kingsic commented on June 19, 2024

第一个问题是cell的循环机制导致你的疑惑,由于子控制器添加到父控制器中,子控制器只会被加载一次,子控制器的 viewDidLoad 只会被触发一次,而 cell 不在屏幕上时,子控制器 view 是被移到缓存池中,如果再次出现在屏幕的时候,会从缓存池再次取出,你可以打印子控制器的 viewDidLoad 方法,看一下其调用次数
第二个问题,采用的是视图加载完成之后显示其内容,而不是一下子全部加载完毕,这里之所以这样做是考虑到 app 的性能问题,当你需要时候才会加载,不需要的时候不会被加载
你可以看一下手机上的这一模块的 app ,都是这 2 种形式,这就是为什么后来添加了 SGPageContentScrollView 类的原因 @XiMuYouZi

from sgpagingview.

XiMuYouZi avatar XiMuYouZi commented on June 19, 2024

恩,理解你说的。

主要是第一点问题,子控制器的view被移到了缓存池,导致该子控制器没法响应事件调用了。

例如我遇到的一个问题:我在三个子控制器里面都埋点接受同一个通知事件,这三个子控制器也都加载了。但是我在其他地方发送通知事件的,发现三个控制器会随机出现有的子控制器没法接受到通知

另外也由于cell的重用机制导致childvc的view会被随机加载,可能已经加载过得childvc的view,滑回来的时候又被加载了一次,其实这是没必要的。

因为有时候需要所有view都被一次加载完毕,并且加载完了后,这些view就一直存在,而collectionview会出现即使这些childvc的view被加载过了,滑动回来,依然会再次加载。
更严重的问题就是我上面说的,由于view被移除了,根本就不响应事件了

from sgpagingview.

kingsic avatar kingsic commented on June 19, 2024

嗯嗯,我在问题及解决方案中做了对 SGPageContentView 与 SGPageContentScrollView 数据处理问题的说明;你可以根据你项目的需求,适当的更改源码 @XiMuYouZi

from sgpagingview.

XiMuYouZi avatar XiMuYouZi commented on June 19, 2024

好的

from sgpagingview.

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.