<legend id='uzzWC'><style id='uzzWC'><dir id='uzzWC'><q id='uzzWC'></q></dir></style></legend>
    <tfoot id='uzzWC'></tfoot>

        <bdo id='uzzWC'></bdo><ul id='uzzWC'></ul>
      <i id='uzzWC'><tr id='uzzWC'><dt id='uzzWC'><q id='uzzWC'><span id='uzzWC'><b id='uzzWC'><form id='uzzWC'><ins id='uzzWC'></ins><ul id='uzzWC'></ul><sub id='uzzWC'></sub></form><legend id='uzzWC'></legend><bdo id='uzzWC'><pre id='uzzWC'><center id='uzzWC'></center></pre></bdo></b><th id='uzzWC'></th></span></q></dt></tr></i><div id='uzzWC'><tfoot id='uzzWC'></tfoot><dl id='uzzWC'><fieldset id='uzzWC'></fieldset></dl></div>

      <small id='uzzWC'></small><noframes id='uzzWC'>

    1. 如何在 iPhone 中制作无限滚动视图?

      时间:2023-05-31

        <tbody id='dY97d'></tbody>

        • <bdo id='dY97d'></bdo><ul id='dY97d'></ul>
        • <tfoot id='dY97d'></tfoot>

        • <legend id='dY97d'><style id='dY97d'><dir id='dY97d'><q id='dY97d'></q></dir></style></legend>
            1. <i id='dY97d'><tr id='dY97d'><dt id='dY97d'><q id='dY97d'><span id='dY97d'><b id='dY97d'><form id='dY97d'><ins id='dY97d'></ins><ul id='dY97d'></ul><sub id='dY97d'></sub></form><legend id='dY97d'></legend><bdo id='dY97d'><pre id='dY97d'><center id='dY97d'></center></pre></bdo></b><th id='dY97d'></th></span></q></dt></tr></i><div id='dY97d'><tfoot id='dY97d'></tfoot><dl id='dY97d'><fieldset id='dY97d'></fieldset></dl></div>

                <small id='dY97d'></small><noframes id='dY97d'>

              • 本文介绍了如何在 iPhone 中制作无限滚动视图?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

                问题描述

                限时送ChatGPT账号..

                我有一个 scrollview,其中有 5 个宽度为 88 的图像视图.

                I have a scrollview with 5 image views of width 88.

                我希望 scrollview 滚动到每个图像视图 (非分页)

                I want the scrollview to scroll to each image view (Not Paging)

                我想在 iPhone 中制作一个无限滚动视图,这意味着当它滚动到最后一个项目时,它会在它旁边显示第一个项目..

                I want to make an infinite scrollview in iPhone which means the when it scroll to last item it will display a first item next to it..

                我一直在尝试按偏移量,但是当按偏移量移动它时它会停止,而且 我使用了苹果街道滚动条,它不允许我将每个元素停止在中心(就像选择器视图)..>

                I have been trying by offset but it stops when move it by offset and also I have used apple street scroller which does not allow me to stop each element in center(just like Picker view)..

                推荐答案

                首先,我推荐使用 UITableView,这样可以保持较低的内存使用率.我在一个项目中成功使用的方法如下:

                First of all, I recommend to use a UITableView so you can maintain the memory usage low. An approach that I had used successfully in a project is the following:

                  1.列表项

                复制单元格的内容,我的意思是如果你有 5 个这样的项目:

                Duplicate the content of your cells, I mean if you have 5 items in this way:

                |1 |2 |3 |4 |5 |

                | 1 | 2 | 3 | 4 | 5 |

                您应该在表格末尾添加相同的内容(在具有可重用引擎的表格视图中,这不是什么大问题),以便看起来像这样:

                You should add the same (In a table view with reusable engine that's not a big deal) at the end of the table in order to look like this:

                |1 |2 |3 |4 |5 |1 |2 |3 |4 |5 |

                | 1 | 2 | 3 | 4 | 5 | 1 | 2 | 3 | 4 | 5 |

                  2.修改 scrollViewDidScroll 如下:
                  2. modify the scrollViewDidScroll with the following:

                -(void)scrollViewDidScroll:(UIScrollView *)scrollView
                {
                    if (scrollView == _yourScrollView) {
                        CGFloat currentOffsetX = scrollView.contentOffset.x;
                        CGFloat currentOffSetY = scrollView.contentOffset.y;
                        CGFloat contentHeight = scrollView.contentSize.height;
                
                        if (currentOffSetY < (contentHeight / 6.0f)) {
                            scrollView.contentOffset = CGPointMake(currentOffsetX,(currentOffSetY + (contentHeight/2)));
                        }
                        if (currentOffSetY > ((contentHeight * 4)/ 6.0f)) {
                            scrollView.contentOffset = CGPointMake(currentOffsetX,(currentOffSetY - (contentHeight/2)));
                        }
                    }
                }
                

                如果您几乎到达滚动的最后,上面的代码将滚动位置移动到顶部;或者,如果您几乎在顶部,则将您移至底部...

                The code above move the scroll position at top if you almost reach the final of the scrolling; Or if you are almost on the top, moves you to the bottom...

                  3.就是这样.

                这篇关于如何在 iPhone 中制作无限滚动视图?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!

                上一篇:如何在 iOS 中检查 SSL 证书的安全性? 下一篇:如何在IOS中查看网络2G或3G?

                相关文章

                最新文章

              • <small id='5kNdN'></small><noframes id='5kNdN'>

                1. <i id='5kNdN'><tr id='5kNdN'><dt id='5kNdN'><q id='5kNdN'><span id='5kNdN'><b id='5kNdN'><form id='5kNdN'><ins id='5kNdN'></ins><ul id='5kNdN'></ul><sub id='5kNdN'></sub></form><legend id='5kNdN'></legend><bdo id='5kNdN'><pre id='5kNdN'><center id='5kNdN'></center></pre></bdo></b><th id='5kNdN'></th></span></q></dt></tr></i><div id='5kNdN'><tfoot id='5kNdN'></tfoot><dl id='5kNdN'><fieldset id='5kNdN'></fieldset></dl></div>

                2. <legend id='5kNdN'><style id='5kNdN'><dir id='5kNdN'><q id='5kNdN'></q></dir></style></legend>
                    • <bdo id='5kNdN'></bdo><ul id='5kNdN'></ul>

                    <tfoot id='5kNdN'></tfoot>