Animation 模态视图正在重置我的现有视图控制器
我使用UIStoryboard中的segue在代码中加载视图控制器。基于一些用户选择的选项,然后我使用动画隐藏或显示UI控件。一切都很好Animation 模态视图正在重置我的现有视图控制器,animation,modal-dialog,uistoryboard,redraw,Animation,Modal Dialog,Uistoryboard,Redraw,我使用UIStoryboard中的segue在代码中加载视图控制器。基于一些用户选择的选项,然后我使用动画隐藏或显示UI控件。一切都很好 - (void)showComments { NSLog(@"Show Comments"); _commentsTextView.hidden = NO; _commentsTextView.frame = CGRectMake(435, 266, 475, 134); [UIView animateWithDuration
- (void)showComments {
NSLog(@"Show Comments");
_commentsTextView.hidden = NO;
_commentsTextView.frame = CGRectMake(435, 266, 475, 134);
[UIView animateWithDuration:1 animations:^{
_commentsTextView.alpha = 1;
_signatureButton.frame = CGRectMake(435, 420, 475, 134);
_cancelButton.frame = CGRectMake(568, 581, 100, 44);
_finishedButton.frame = CGRectMake(676, 581, 100, 44);
}];
}
然后,我将使用以下代码介绍在UIStoryboard中创建的视图控制器:
UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"MainStoryboard_iPad" bundle:nil];
SigningViewController *signingVC = (SigningViewController *)[storyboard instantiateViewControllerWithIdentifier:@"SigningViewController"];
signingVC.object = self;
signingVC.signatureProperty = @"employeeSignature";
signingVC.startDate = self.startDate;
signingVC.endDate = self.endDate;
[self presentViewController:signingVC animated:YES completion:nil];
当这段代码触发时,除了一件事之外,所有发生的事情都会按预期发生:隐藏或显示UI控件的所有自定义动画都会恢复。这就好像通过调用presentViewController方法,它正在从UIStoryboard重新绘制我的现有视图
有没有办法让它在以模式显示新视图之前退出重画/重新加载故事板中的现有视图?我也有同样的问题。无论我试图在模态关闭时进行动画更改,它似乎会重置回原始情节提要
我必须采用的解决方案是将任何动画视图添加为头文件的出口。将视图从情节提要上视图控制器的self.view或main视图中移除,并以编程方式将其添加为子视图。将帧设置为所需的位置,并且在结束模式后,所有动画位置应相同。如果你需要更多的解释并让我知道,这对我很有用 我也遇到了同样的问题,并以更详细的形式发布在这里,一位名叫kokx的用户帮了我很多忙,答案记录在中