简体   繁体   English

如何将Moda视图的背景设置为半透明?

[英]How can set the background of the moda view to be Translucent?

I call my ModalViewController by tapping into a Button. 我通过点击一个按钮来调用我的ModalViewController。 I want this ModalViewController have a Translucent background like below: 我希望此ModalViewController具有如下的半透明背景:

在此处输入图片说明

when i use [self.view setBackgroundColor:[UIColor clearColor]]; 当我使用[self.view setBackgroundColor:[UIColor clearColor]]; it gives me a black background: 它给了我黑色背景:

在此处输入图片说明

    [modalView.view setBackgroundColor:[UIColor clearColor]];

或者如果您想降低不透明度

 [modalView.view setalpha:0.4]; //range is from 0(transparent) to 1(opaque)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何在全屏上设置演示文稿以在iOS 7中显示半透明视图 - how to set presentation over fullscreen to show translucent view in iOS 7 如何通过代码将UISearchBar设置为黑色半透明? - How Can I Set UISearchBar to Black Translucent Via Code? 未选择时,如何将UITableViewCell的背景视图设置为选定的背景? - How can set the background view of a UITableViewCell to the selected background when it is not selected? 如何创建半透明模态UIViewController? - How can I create a translucent modal UIViewController? 如何设置视图的背景图像? - How to set background image of a view? 如何设置视图的背景图像? - How to set background image for a View? iPhone开发:如何为UIActionSheet创建彩色或半透明背景? - iPhone development: How to create colored or translucent background for UIActionSheet? 如何在UItableViewCell中将附件视图背景设置为与内容视图相同的背景? - How to set accessory view background to same background as content view in UItableViewCell? 尝试将tabBarController设置为半透明。 但是没有用。 可以设置Alpha - Trying to set tabBarController translucent. But not working. Alpha can be set 如何在不同视图中的某个视图中设置多个按钮的背景图像? - How can I set the background image of multiple buttons in a certain view from a different view?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM