Reputation: 2941
Have a view which I want to make transparent, it works on the simulator, but for some reason not on my device. I have no idea why this happens. My code looks like this:
- (void)viewDidLoad
[...]
UIView *transparentBackgroundView = [[UIView alloc] initWithFrame:self.view.frame];
// Doesn't work on my device.
transparentFlipBackgroundView.backgroundColor = [UIColor clearColor];
// I have also tried.
// transparentFlipBackgroundView.alpha = 0;
// transparentFlipBackgroundView.opaque = YES
// transparentFlipBackgroundView.layer.backgroundColor = [UIColor clearColor].CGColor;
// I later add the view to an array...
self.pageViews = [[NSMutableArray alloc] initWithObjects:transparentFlipBackgroundView, lastPage, nil];
[...]
}
Any ideas why this happens, and how should I make the UIView transparent?
Upvotes: 3
Views: 989
Reputation: 11
I was having this problem with XCode5 and iOS7 SDK. I found that I had turned on "Increase Contrast" under the Accessibility settings (Settings/General/Accessibility). This caused the Navigation bar to be less transparent than it would be if this setting were turned OFF.
Turned it OFF and now I can see some transparency behind the bars. It's still not as much as the simulator, but it's better now.
Upvotes: 1
Reputation: 8131
Try to change
transparentFlipBackgroundView.backgroundColor = [UIColor clearColor];
to
transparentFlipBackgroundView.backgroundColor =
[UIColor colorWithRed:0 green:0 blue:0 alpha:0];
Upvotes: 2
Reputation: 2941
Pretty hacky solution,but I fixed it by making the view with CGRectZero.
Upvotes: 0
Reputation: 195
Have you got another device you can try it on? If it works on the simulator, surely it should work on your device too? If you'd like, I wouldn't mind trying on one of my devices.
Upvotes: 1