3
私はUIViewController派生クラスを持っていますが、親ビュー(メインUIViewController.view)が50である間に透明ではないサブビューがあります。透明度%。子ビューが正常である間に半透明ビューを取得する方法
コントローラクラスのviewDidLoadでは、ビューとサブビューのアルファ値を設定します。しかし、私が見ているのは、ベースビューとサブビューの両方が半透明であるということです。これが起こらない方法がありますか?
// Class declaration
@interface MyViewControllerClass : UIViewController
{ }
@property (nonatomic, strong) IBOutlet UIView *contentView;
@end
// Class implementation
- (void)viewDidLoad
{
// I want the main view to be a transparent overlay
[self.view setBackgroundColor:[UIColor lightGrayColor]];
[self.view setAlpha:0.5];
// This is the subview I want to look normal
[self.contentView setAlpha:1.0];
[self.contentView setOpaque:NO];
[super viewDidLoad];
}
ありがとうございました。私は別のオーバーレイビューを作成し、意図したとおりに動作します。 –