菜鸟教程小白 发表于 2022-12-12 09:15:31

ios - 如何向 "done"按钮键盘添加 Action ?


                                            <p><p> <a href="/image/PYmpo.png" rel="noreferrer noopener nofollow"><img src="/image/PYmpo.png" alt="enter image description here"/></a> </p>

<p>我有一个测验。我想进入下一个问题是使用键盘上的“完成”按钮进行的​​。我该怎么做?</p></p>
                                    <br><hr><h1><strong>Best Answer-推荐答案</ strong></h1><br>
                                            <p><p>您可以通过添加此行来设置返回键类型的类型:</p>

<pre><code> txtField.returnKeyType = UIReturnKeyDone;
</code></pre>

<p>对于句柄操作,您可以这样做:</p>

<pre><code>- (BOOL)textFieldShouldReturn:(UITextField *)textField
{
    // you can handle here
    return YES;
}
</code></pre></p>
                                   
                                                <p style="font-size: 20px;">关于ios - 如何向&#34;done&#34;按钮键盘添加 Action ?,我们在Stack Overflow上找到一个类似的问题:
                                                        <a href="https://stackoverflow.com/questions/33061972/" rel="noreferrer noopener nofollow" style="color: red;">
                                                                https://stackoverflow.com/questions/33061972/
                                                        </a>
                                                </p>
                                       
页: [1]
查看完整版本: ios - 如何向 &#34;done&#34;按钮键盘添加 Action ?