私の問題は... 私は親ビューコントローラのオブジェクトを持っていて、それを上に2番目のビューコントローラをアニメーション化したかったのです。 私はparentvc.viewのビューの上にbackgroundviewという名前のサブビューを追加し、backgroundViewの上に描画する必要があるビューを追加しました。 しかし、アニメーションが1秒間完了した後、私はそれらを望む方法でビューを見ることができますが、完全な黒いスクリーンに置き換えられます。UIAnimationの後にUI画面が黒くなる
私は一番上のビューが再描画されていると思いますので、どうすればこの問題を解決できますか?
コード: -
- (void)viewDidLoad {
[super viewDidLoad];
//_colorCaptureOptions = [NSArray arrayWithObjects: @"Camera", @"Color Slider/Color Wheel", nil];
mExtractionQueue = [[NSOperationQueue alloc] init];
[mExtractionQueue setMaxConcurrentOperationCount:1];
CGRect screenRect = [[UIScreen mainScreen] bounds];
//CGRect screenRect = self.view.frame;
self.backgroundView = [[UIView alloc] initWithFrame:screenRect];
self.backgroundView.backgroundColor = [UIColor clearColor];
[self.parentVC addChildViewController:self];
[self.parentVC.view addSubview:self.backgroundView];
//[self didMoveToParentViewController:self.parentVC];
UITapGestureRecognizer *guideTap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(handleScrimSelected)];
[self.backgroundView addGestureRecognizer:guideTap];
[self.backgroundView addSubview:self.view];
}
-(void)viewWillAppear:(BOOL)animated {
[super viewWillAppear:animated];
if(UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPhone) {
CGRect screenRect = [[UIScreen mainScreen] bounds];
CGFloat viewHeight = 150;
self.backgroundView.alpha = 0.0;
self.view.alpha = 1;
self.view.frame = CGRectMake(0, screenRect.size.height, screenRect.size.width, viewHeight);
[UIView animateWithDuration:0.2
delay:0
options: UIViewAnimationOptionCurveEaseInOut
animations:^{
self.backgroundView.alpha = 1.0;
self.view.frame = CGRectMake(0, screenRect.size.height - viewHeight, screenRect.size.width, viewHeight);
}
completion:^(BOOL _finished) {
}];
}
}
こんにちは、私には、ポイントコードのサンプルコードを教えてください。 4.また、アニメーションブロックのフレームを変更することは悪いアイデアだと言いました....なぜそうですか? –
こんにちはIgor、clearColorの問題は何ですか? –