菜鸟教程小白 发表于 2022-12-13 02:28:39

ios - 如何检测 iOS 8 中按下的键盘 "PAGE UP"键?


                                            <p><p>我想检测用户何时按下“<strong>page up</strong>”或“<strong>page down</strong>”键。</p>

<p>我使用了 <code>UITextView</code> 和 <strong></strong>, </p>

<p>它适用于 iOS 7。</p>

<pre><code> modifierFlags:0 action: @selector(pageUpKeyPressed:)]
</code></pre>

<p><em>(PageUp: 0b, PageDown: 0c)</em></p>

<p>但它不适用于 iOS8。 </p>

<p>在 iOS 8 上是否有检测“<em>page up/down</em>”键?</p></p>
                                    <br><hr><h1><strong>Best Answer-推荐答案</ strong></h1><br>
                                            <p><p>我注意到预定义的常量 UIKeyInputUpArrow 等只是包含符号名称的字符串,例如 @"UIKeyInputUpArrow"。所以我尝试使用 </p>

<pre><code>[UIKeyCommand keyCommandWithInput:@&#34;UIKeyInputPageUp&#34;
                  modifierFlags:0
                           action:@selector(pageUpKeyPressed:)];
</code></pre>

<p>只是一时兴起。瞧,它起作用了! (在 iOS 10 中)
不知道这是否有资格使用未记录的 API。使用它可能会或可能不会让您的应用被 App Store 拒绝。</p></p>
                                   
                                                <p style="font-size: 20px;">关于ios - 如何检测 iOS 8 中按下的键盘&#34;PAGE UP&#34;键?,我们在Stack Overflow上找到一个类似的问题:
                                                        <a href="https://stackoverflow.com/questions/26214056/" rel="noreferrer noopener nofollow" style="color: red;">
                                                                https://stackoverflow.com/questions/26214056/
                                                        </a>
                                                </p>
                                       
页: [1]
查看完整版本: ios - 如何检测 iOS 8 中按下的键盘 &#34;PAGE UP&#34;键?