I’m calling a method from another view controller by using this:
InitialViewController *secondController = [[InitialViewController alloc] init];
[secondController forecast];
Here’s the method in the InitialViewController:
-(void)forecast{
[UIView beginAnimations:@"Forecast" context:nil];
[UIView setAnimationCurve:UIViewAnimationCurveEaseInOut];
[UIView setAnimationDuration:1.0f];
self.customPager.frame = CGRectMake(0,5, 320, 510);
self.view1.frame = CGRectMake(-320,5, 320, 510);
radarView.frame = CGRectMake(0,560, 320, 510);
[UIView commitAnimations];
NSLog(@"Method Passed");
}
In my console, I get the NSLog “Method Passed”, but the UIView animation does not occur at all. Any ideas?
It seems to me that you are not displaying in any way the view associated to
secondController. I.e., after doing:I would expect you do something like:
This would trigger
loadView/viewDidLoadbefore you callforecast. Furthermore, I would give a chance to the UI to be show your view before animating it; thus, I would callforecasteither like this:or from
viewDidAppear.EDIT:
According to your comment,
your
InitialViewControlleris already displayed on screen. In this case, what you should do is getting a reference to it and sending it theforecastmessage.What you are doing now is instantiating a new
InitialViewController(and then sending theforecastmessage to it) that has no relation with the one already displayed.