菜鸟教程小白 发表于 2022-12-12 09:46:26

ios - UINavigationBar 比它必须要小


                                            <p><p>我正在开发一个应用程序,我有一个登录/退出流程。当用户单击退出按钮时,我希望将用户带到主屏幕。为此,我在应用委托(delegate)中创建了以下方法:</p>

<pre><code>- (void) restartAppWhenLogOut{
    self.window = [ initWithFrame:[ bounds]];
    WelcomViewController *welcomeViewController = [init];
    self.navController = [ initWithRootViewController:welcomeViewController];
    ;
    ;
}
</code></pre>

<p>当用户点击“退出”按钮时,我称之为:</p>

<pre><code>[.delegate restartAppWhenLogOut];
</code></pre>

<p>除了一件事之外,它工作正常。 UINavigationBar 比它应该的要小!这是它的外观截图:</p>

<p> <img src="/image/Z7Hjh.png" alt="enter image description here"/> </p>

<p>UINavigationBar 应该填充一条小黑线...</p>

<p>知道为什么会这样吗? </p>

<p>========================================编辑======= =================================</p>

<p>我删除了新窗口的创建,因为 <code>David M.</code> 在一条评论中告诉我这样做,但它仍然失败:</p>

<pre><code>;
WelcomViewController *welcomeViewController = [init];
self.navController = [ initWithRootViewController:welcomeViewController];
;
</code></pre></p>
                                    <br><hr><h1><strong>Best Answer-推荐答案</ strong></h1><br>
                                            <p><p>我试图找出错误..但没有发现..所以,我建议您尝试手动设置导航栏..</p></p>
                                   
                                                <p style="font-size: 20px;">关于ios - UINavigationBar 比它必须要小,我们在Stack Overflow上找到一个类似的问题:
                                                        <a href="https://stackoverflow.com/questions/15481520/" rel="noreferrer noopener nofollow" style="color: red;">
                                                                https://stackoverflow.com/questions/15481520/
                                                        </a>
                                                </p>
                                       
页: [1]
查看完整版本: ios - UINavigationBar 比它必须要小