tudoutiaoya
V2EX  ›  iOS

iOS 实现三张图片 无限滚动,都有什么思路以及方案🤔

  •  
  •   tudoutiaoya · Sep 7, 2023 · 1896 views
    This topic created in 980 days ago, the information mentioned may be changed or developed.

    需求:总共三张图片,实现三张图片无限循环滚动,都有什么思路以及方案:

    样例: http://cdn.tudoutiao.pro/2023-09-07%2011.23.28.gif

    1 replies    2023-09-08 10:52:02 +08:00
    357272055
        1
    357272055  
       Sep 8, 2023
    CollectionView 设置一个很大的 numberOfCells 数值( like 200000 ),cellForItem 的时候根据 indexPath.item % 3 的值去判断显示哪张图片,然后页面加载出来的时候就滚动到页面中间
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   3357 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 53ms · UTC 12:41 · PVG 20:41 · LAX 05:41 · JFK 08:41
    ♥ Do have faith in what you're doing.