菜鸟教程小白 发表于 2022-12-12 13:36:18

ios - 需要帮助将光标移动到 UITextView Obj C 中的开始位置


                                            <p><div>
            <aside class="s-notice s-notice__info post-notice js-post-notice mb16"role="status">
      <div class="d-flex fd-column fw-nowrap">
            <div class="d-flex fw-nowrap">
                <div class="flex--item wmn0 fl1 lh-lg">
                  <div class="flex--item fl1 lh-lg">
                        <b>这个问题在这里已经有了答案</b>:
                        
                  <br><hr><h1><strong>Best Answer-推荐答案</ strong></h1><br>
                                            <p><p>这对我来说很好。</p>

<pre><code>dispatch_async(dispatch_get_main_queue(), ^{
    textView.selectedRange = NSMakeRange(0, 0);
});
</code></pre>

<p>只要你想设置你的 textview 位置开始,你就可以使用这个代码。</p>

<p>如果您希望光标在一个字母后开始,请将您的范围更改为 <code>(1,0)</code>。</p></p>
                                   
                                                <p style="font-size: 20px;">关于ios - 需要帮助将光标移动到 UITextView Obj C 中的开始位置,我们在Stack Overflow上找到一个类似的问题:
                                                        <a href="https://stackoverflow.com/questions/45274005/" rel="noreferrer noopener nofollow" style="color: red;">
                                                                https://stackoverflow.com/questions/45274005/
                                                        </a>
                                                </p>
                                       
页: [1]
查看完整版本: ios - 需要帮助将光标移动到 UITextView Obj C 中的开始位置