0

NavigationController pushviewcontrollerのアニメーションのようなアニメーションをしたいです。しかし、私はNavigationControllerを持っていません。作りたくありません。

それで、UIViewControllerでアニメーションを行うことは可能ですか? ありがとう!


言い忘れましたが、ボタンをクリックした後にビューを切り替えようとしています。現在presentModalViewControllerを使用していますが、アニメーションが好きではありません..

4

2 に答える 2

1

サブビューのプロパティをアニメーション化originし、メイン ビューに追加した直後に x 軸に沿って減少させることができます。

編集 :

次のようなものを使用します。

// retrieve the screen bounds
CGRect sBounds = [[UIScreen mainScreen] bounds];
// the origin point is just on the right of the screen
CGRect newFrame = CGRectMake(sBounds.size.width,
                             0.0,
                             sBounds.size.width,
                             sBounds.size.height);
// set your view frame
[mySecondView setFrame:newFrame];
// add it to the main view
[mainView addSubview:mySecondView];
// then animate your view
[UIView animateWithDuration:0.5     // set the interval you want
                 animations:^{
                     mySecondView.frame.origin = sBounds.origin;
                 }
];
于 2011-07-11T13:51:33.607 に答える
0

ナビゲーションコントローラーを使用してナビゲーションバーを非表示にしますが、それをしたくないので[UIView beginAnimantion: @"myAnimation" withContext: nil];、フレームまたは原点を使用および変更してビューを切り替えることができます。

于 2011-07-11T13:53:27.477 に答える