Starejaz
Starejaz

Reputation: 73

UIView clearColor produce WhiteColor instead of Transparent in IOS5 Xcode4.2

I am facing a very strange issue ever since I updated the Xcode with IOS 5 ... I can't able to set the background Color of UIView to Transparent ...

here is What I can do :!!

I can set the view to any color , green , blue , red and they are all shown correctly on UIVIEW

    [self.view setBackgroundColor:[UIColor greenColor]];     // Working 100 % 

I can set a background Image // it's Working too

  [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 

instead of transparent Background , it is always WHITE ... !!

I'll appreciate the help in figuring out the problem!! :)

Upvotes: 0

Views: 1755

Answers (1)

thekmc
thekmc

Reputation: 516

I've just had this same problem. Here's a couple things to do. Firstly, make sure you set the view so it's not opaque:

[self.view setOpaque:NO];

Second, set the views layer so it's also clearColor:

[self.view.layer setBackgroundColor:[UIColor clearColor]];

See if that helps. It fixed my problem, and your's sounds just like mine. Good luck.

Upvotes: 1

Related Questions