我的问题是。。。
我有父视图控制器的对象,我想在上面设置第二个视图控制器的动画。
所以我在parentvc的视图上添加了一个子视图backgroundview。视图,然后是需要在背景视图上绘制的视图。
但在动画完成一秒钟后,我可以看到我想要的视图,但随后它被一个完整的黑屏所取代。
我认为我的最高观点已经被重新画出来了,所以我该如何纠正这个问题。
代码:-
- (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) {
}];
}
}