Below is my code..
TestTemp1ViewController *temp=[[TestTemp1ViewController alloc]init];
[self.view addSubview:temp.view];
[self presentModalViewController:temp animated:FALSE];
This codes works well in iOS 5.0 but crashes in iOS 6.0.
Crash report: [UIViewController loadViewIfRequired]-- bad excess
I cannot understand why this isn’t working in iOS 6.0. Guys, ya I know that’s not the good way but what I am trying to do is presentviewcontroller with grow and shrink animation. If I do this after I present then I will get white background of view controller.
Below is my code…
-(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;
}
}.
Also the controller in which I am doing this is also presented modally if I remove that then it’s works in ios 6. Any other idea to achieve zooming and shrinking.
I was setting presentation style wrong..It should be like this..
self.modalPresentationStyle = UIModalPresentationCurrentContext;
It should be on current context.So, Now presented view controller view will be drawn on transparent background and not on white background so while shrinking it’s view, there will be no white background behind it.