Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/unit-testing/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
UIView clearColor在IOS5 Xcode4.2中生成白色而不是透明_Uiview_Ios5_Transparency_Background Color_Xcode4.2 - Fatal编程技术网

UIView clearColor在IOS5 Xcode4.2中生成白色而不是透明

UIView clearColor在IOS5 Xcode4.2中生成白色而不是透明,uiview,ios5,transparency,background-color,xcode4.2,Uiview,Ios5,Transparency,Background Color,Xcode4.2,自从我用IOS 5更新Xcode之后,我面临着一个非常奇怪的问题。。。 我无法将UIView的背景色设置为透明 以下是我能做的: 我可以将视图设置为任何颜色,绿色、蓝色、红色,它们都在UIVIEW上正确显示 [self.view setBackgroundColor:[UIColor greenColor]]; // Working 100 % 我可以设置背景图像//它也在工作 [self.view setBackgroundColor:[UIColor colorWit

自从我用IOS 5更新Xcode之后,我面临着一个非常奇怪的问题。。。 我无法将UIView的背景色设置为透明

以下是我能做的:

我可以将视图设置为任何颜色,绿色、蓝色、红色,它们都在UIVIEW上正确显示

    [self.view setBackgroundColor:[UIColor greenColor]];     // Working 100 % 
我可以设置背景图像//它也在工作

  [self.view setBackgroundColor:[UIColor colorWithPatternImage:[UIImage imageNamed:@"abc2010.png"]]]; // Working 100 %


  [self.view setBackgroundColor:[UIColor clearColor]];       // No Error but result is not what I need 
而不是透明的背景,它总是白色的


我将感谢你帮我解决这个问题!!:)

我也遇到了同样的问题。这里有几件事要做。 首先,确保将视图设置为不不透明:

[self.view setOpaque:NO];
第二,设置视图层,使其也为clearColor:

[self.view.layer setBackgroundColor:[UIColor clearColor]];
看看这是否有帮助。它解决了我的问题,你的声音和我的一样。 祝你好运