有一个我想让它透明的视图,它可以在模拟器上运行,但由于某种原因不在我的设备上。我不知道为什么会这样。我的代码如下所示:
- (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];
[...]
}
任何想法为什么会发生这种情况,我应该如何使 UIView 透明?