私のアプリでは、UIViewController を上から下に起動したいので、FirstViewController から次のように MyWebViewController (アニメーション化する必要があります) を起動しています。
MyWebViewController *theWebViewController = [[MyWebViewController alloc] initWithFrame:self.view.bounds];
[self.view addSubview:theWebViewController.view];
MyWebViewController の loadView では、次のようにフレームをビューに割り当てています。
- (void)loadView
{
CGRect theFrame;
theFrame = CGRectMake(0.0, 20.0, mFrame.size.width, 0.0);
UIView *view = [[UIView alloc] init];
view.frame = theFrame;
self.view = view;
[view release];
}
viewDidLoad では、次のようにフレームを変更しています。
- (void)viewDidLoad
{
[super viewDidLoad];
self.view.backgroundColor = [UIColor clearColor];
self.view.autoresizingMask = UIViewAutoresizingFlexibleWidth |UIViewAutoresizingFlexibleHeight;
[UIView beginAnimations:@"animateView" context: nil];
[UIView setAnimationBeginsFromCurrentState:YES];
[UIView setAnimationDuration:0.5];
self.view.frame = CGRectMake(0.0, 20.0, mFrame.size.width, mFrame.size.height-20.0);
[UIView commitAnimations];
}
しかし、アニメーションは発生していません。下から上にアニメーション化するためにこのコードを試してみましたが、正常に動作していますが、その逆は機能していません。どこが間違っているのか、どうすれば達成できるのか教えてください。
前もって感謝します!