菜鸟教程小白 发表于 2022-12-11 16:43:08

ios - 更改从 UIActivityViewController 打开的模态视图 Controller 的状态栏文本颜色


                                            <p><p>从 <code>UIActivityViewController</code> 中选择一个事件(邮件、消息等)后,我们如何更改打开的模态视图 Controller 的颜色。</p>

<p>我尝试将 <code>Status bar style</code> 设置为 <code>UIStatusBarStyleLightContent</code>,但没有成功。 <code>基于 ViewController 的状态栏外观</code>设置为<code>NO</code>。我的应用程序有许多 <code>UIViewController</code>s,我需要状态栏文本的颜色为白色,而在某些情况下,我需要它为黑色,我需要状态栏文本的颜色从 <code>UIActivityViewController</code> 打开事件时为白色。如何实现?</p>

<p>我尝试了 <a href="https://stackoverflow.com/a/24909088/4533932" rel="noreferrer noopener nofollow">here</a> 中的一些内容通过以下方式 - </p>

<pre><code>[self presentViewController:activityVC animated:YES completion:^{
            [ setStatusBarStyle:UIStatusBarStyleLightContent];
}];
</code></pre>

<p>但它不起作用。</p></p>
                                    <br><hr><h1><strong>Best Answer-推荐答案</ strong></h1><br>
                                            <p><p>据我所知,除了你的方法,我们可以用这个方法
<code>
- (UIStatusBarStyle)preferredStatusBarStyle
</code>
activityVC 所在的地方,并返回 UIStatusBarStyleLightContent.Hope 来帮助你。</p></p>
                                   
                                                <p style="font-size: 20px;">关于ios - 更改从 UIActivityViewController 打开的模态视图 Controller 的状态栏文本颜色,我们在Stack Overflow上找到一个类似的问题:
                                                        <a href="https://stackoverflow.com/questions/37787516/" rel="noreferrer noopener nofollow" style="color: red;">
                                                                https://stackoverflow.com/questions/37787516/
                                                        </a>
                                                </p>
                                       
页: [1]
查看完整版本: ios - 更改从 UIActivityViewController 打开的模态视图 Controller 的状态栏文本颜色