下面是我的代码..
TestTemp1ViewController *temp=[[TestTemp1ViewController alloc]init];
[self.view addSubview:temp.view];
[self presentModalViewController:temp animated:FALSE];
此代码在 iOS 5.0 中运行良好,但在 iOS 6.0 中崩溃。
Crash report: [UIViewController loadViewIfRequired]-- bad excess
我不明白为什么这在 iOS 6.0 中不起作用。伙计们,是的,我知道这不是好方法,但我想做的是呈现具有增长和收缩动画的视图控制器。如果我在演示后这样做,那么我将获得视图控制器的白色背景。
下面是我的代码...
-(void)animateGrowAndShrink:(ViewController *)controller1 {
//self.view.userInteractionEnabled=NO;
[self.view addSubview:controller1.view];
[self presentModalViewController:self.controller animated:FALSE];
if (dayTimeLineIsShown) {
//shrink dayTimeLineIsShown=FALSE;
[UIView beginAnimations:@"animationShrink" context:NULL];
[UIView setAnimationDuration:.61f];
controller1.view.transform=CGAffineTransformMakeScale(.01f,.01f);
} else {
//expand dayTimeLineIsShown=TRUE;
controller1.view.transform=CGAffineTransformMakeScale(0.01,0.01);
[UIView beginAnimations:@"animationExpand" context:NULL];
[UIView setAnimationDuration:.60f];
timeLine.view.transform=CGAffineTransformMakeScale(1, 1);
}
[UIView setAnimationDelegate:self];
[UIView setAnimationDidStopSelector:@selector(animationDidStop:finished:context:)];
[UIView commitAnimations];
}
-(void)animationDidStop:(NSString *)animationID finished:(BOOL)finished context:(void *)context{
self.view.userInteractionEnabled=YES;
if ([animationID isEqualToString:@"animationExpand"]) {
[self presentModalViewController:self.controller1 animated:FALSE];
} else {
self.controller.view.hidden=true;
}
}.
此外,如果我删除它,我正在执行此操作的控制器也会以模态方式呈现,那么它可以在 ios 6 中使用。实现缩放和缩小的任何其他想法。