菜鸟教程小白 发表于 2022-12-11 16:40:39

ios - ios中uiscrollview的底部刷新控件


                                            <p><p>如何在 UIScrollView 的底部添加 UIRefreshController。
我正在 UIScrollView 中实现加载更多选项,以便我可以将更多数据加载到 ScrollView 中。</p>

<p>在此先感谢...</p></p>
                                    <br><hr><h1><strong>Best Answer-推荐答案</ strong></h1><br>
                                            <p><p>将您的数据放入表格 View 中,然后可以使用标准的 <code>UITableViewDelegate</code> 回调轻松完成。不要试图操纵 Apple 自己的 UIRefreshControl 进入表格或 ScrollView 的底部,因为它会以麻烦告终。</p>

<p>这样做:</p>

<p>在您的 <code>tableView:numberOfRowsInSection:</code> 中返回 <code>data.count+1</code></p>

<p>在您的 <code>tableView:cellForRowAtIndexPath:</code> 中检查 <code>if (indexPath.row == data.count)</code>。如果是这样,创建并返回一个基本单元格,其文本标签设置为“加载更多...”</p>

<p>在您的 <code>tableView:didSelectRowAtIndexPath:</code> 中再次检查 <code>if (indexPath.row == data.count)</code>。如果是这样,请触发您自己的 <code></code> 方法,然后调用 <code></code>。</p></p>
                                   
                                                <p style="font-size: 20px;">关于ios - ios中uiscrollview的底部刷新控件,我们在Stack Overflow上找到一个类似的问题:
                                                        <a href="https://stackoverflow.com/questions/37695048/" rel="noreferrer noopener nofollow" style="color: red;">
                                                                https://stackoverflow.com/questions/37695048/
                                                        </a>
                                                </p>
                                       
页: [1]
查看完整版本: ios - ios中uiscrollview的底部刷新控件