菜鸟教程小白 发表于 2022-12-12 17:23:23

ios - UIPopovercontroller 中的 UIReferenceLibraryViewController


                                            <p><p>建议我使用 UIPopovercontroller 来显示我的 UIReferenceLIbraryViewController,这样当我单击 UIButton“搜索”时字典不会占据整个屏幕</p>

<p>我拥有的是一个 UITextField,它接收字符串/单词,一个搜索它并拉起 UIReferenceLibraryViewController 的按钮。 </p>

<p>我在使用 popovercontroller 执行此操作时遇到问题。当我尝试它时,按钮没有响应。任何提示/帮助? </p>

<p>编辑:</p>

<p> <a href="https://stackoverflow.com/questions/20643742/uireferencelibraryviewcontroller-in-subview" rel="noreferrer noopener nofollow">UIReferenceLibraryViewController in a popover</a> </p>

<p>原来是</p>

<pre><code>if()
    {

      UIReferenceLibraryViewController *referenceLibraryVC = [ initWithTerm:searchTerm];

      ;

            }
</code></pre>

<p>这让它占据了整个 ipad 屏幕</p>

<p>UIReferenceLIbraryViewController 有 initWithFrame 吗?该解决方案似乎对我也不起作用</p></p>
                                    <br><hr><h1><strong>Best Answer-推荐答案</ strong></h1><br>
                                            <p><p>感谢 Leo Nathan 的帮助,现在可以使用了。</p>

<pre><code> self.masterPopOverController = [ initWithContentViewController:referenceLibraryVC];
       inView: permittedArrowDirections:UIPopoverArrowDirectionAny animated:YES];
</code></pre>

<p>我没有在 XIB 文件中正确连接它,并且它没有在 ButtonPress 的 IBAction 中的正确位置实现</p></p>
                                   
                                                <p style="font-size: 20px;">关于ios - UIPopovercontroller 中的 UIReferenceLibraryViewController,我们在Stack Overflow上找到一个类似的问题:
                                                        <a href="https://stackoverflow.com/questions/20666167/" rel="noreferrer noopener nofollow" style="color: red;">
                                                                https://stackoverflow.com/questions/20666167/
                                                        </a>
                                                </p>
                                       
页: [1]
查看完整版本: ios - UIPopovercontroller 中的 UIReferenceLibraryViewController