菜鸟教程小白 发表于 2022-12-11 18:27:31

iOS 使用箭头键导航 TableView


                                            <p><p>如何使用箭头键(物理键盘)导航 UITableView,就像 iOS 10 中引入的聚光灯行为一样?</p>

<p>希望用户在搜索框中输入内容并使用向上/向下箭头突出显示表格 View 中的一行,然后按回车键选择该行。</p>

<p>我没有找到任何关于该主题的资源。</p>

<p>请提供 Swift 示例代码。</p></p>
                                    <br><hr><h1><strong>Best Answer-推荐答案</ strong></h1><br>
                                            <p><p>没试过,但这可能是你的答案。</p>

<pre><code>self.tableView.scrollToRowAtIndexPath(indexPath, atScrollPosition: .Top, animated: true)
</code></pre>

<p>并使用文本字段委托(delegate)来处理返回。</p>

<p>编辑:用于突出显示</p>

<pre><code>tableView(tableView: UITableView!, cellForRowAtIndexPath indexPath: NSIndexPath!) -&gt; UITableViewCell!
</code></pre>

<p>并更新您的单元格视觉效果</p></p>
                                   
                                                <p style="font-size: 20px;">关于iOS 使用箭头键导航 TableView,我们在Stack Overflow上找到一个类似的问题:
                                                        <a href="https://stackoverflow.com/questions/41400095/" rel="noreferrer noopener nofollow" style="color: red;">
                                                                https://stackoverflow.com/questions/41400095/
                                                        </a>
                                                </p>
                                       
页: [1]
查看完整版本: iOS 使用箭头键导航 TableView