菜鸟教程小白 发表于 2022-12-11 20:56:19

ios - 如何在 TableView 中获取选定的 UITableViewCell 的来源?


                                            <p><p>由于 tableView 正在滚动,因此很难通过以下方式知道它在屏幕上的当前位置
选择前所有行的乘法 heightForRowAtIndex。</p>

<p>有没有其他方法可以在 <strong>tableView</strong> 或 <strong>screen</strong> 中获取 <strong>selected tableViewCell</strong> 的 <strong>Y 坐标</strong>?
我尝试获取单元格框架或边界,但在 didSelectRowAtIndexPath 方法中获取 (0,0,0,0) 矩形。</p></p>
                                    <br><hr><h1><strong>Best Answer-推荐答案</ strong></h1><br>
                                            <p><p>scrollView 滚动时,其上的位置不变,
实际上是内容 View 移动了。 </p>

<p>Tableview 是一种 ScrollView 。您可以获得一个属性“contentOffset”,这可能会对您有所帮助。</p></p>
                                   
                                                <p style="font-size: 20px;">关于ios - 如何在 TableView 中获取选定的 UITableViewCell 的来源?,我们在Stack Overflow上找到一个类似的问题:
                                                        <a href="https://stackoverflow.com/questions/9308059/" rel="noreferrer noopener nofollow" style="color: red;">
                                                                https://stackoverflow.com/questions/9308059/
                                                        </a>
                                                </p>
                                       
页: [1]
查看完整版本: ios - 如何在 TableView 中获取选定的 UITableViewCell 的来源?