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

ios - iPhone中presentViewController时如何保持背景透明?


                                            <p><p>我想像 iPhone iOS6 中的 UIActivityController 一样保持背景透明
<img src="/image/OuGHO.png" alt="enter image description here"/> </p>

<p>我尝试像这样清除颜色和不透明但背景总是黑色(iPhone iOS5 模拟器)</p>

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

<p>这是presentViewController代码:</p>

<pre><code>    ShareViewController *controller = [ initWithNibName:@&#34;ShareViewController_iPhone&#34; bundle:nil];
    controller.delegate = self;

    [self presentViewController:controller animated:YES completion:^{
      NSLog(@&#34;Activity complete&#34;);
    }];
</code></pre>

<p>请帮忙!谢谢!</p></p>
                                    <br><hr><h1><strong>Best Answer-推荐答案</ strong></h1><br>
                                            <p><p>看看你必须做的是在你提到的自定义 <code>UIActionsheet</code> 后面添加一个 <code>UIView</code> 。在这里您可以做的是保持 <code>UIView</code> 的背景颜色为白色,然后保持其 alpha = 0.5。 </p>

<p>当您关闭 <code>UIActionsheet</code> 时,您也可以 <code>removeFromSuperview</code> 后面添加的 <code>UIView</code>。</p></p>
                                   
                                                <p style="font-size: 20px;">关于ios - iPhone中presentViewController时如何保持背景透明?,我们在Stack Overflow上找到一个类似的问题:
                                                        <a href="https://stackoverflow.com/questions/18009084/" rel="noreferrer noopener nofollow" style="color: red;">
                                                                https://stackoverflow.com/questions/18009084/
                                                        </a>
                                                </p>
                                       
页: [1]
查看完整版本: ios - iPhone中presentViewController时如何保持背景透明?