0

アプリで tabbarcontroller を使用しており、その中にいくつかのビューコントローラーがあり、通常の標準的なものです。最近、コンテンツ ビューからボタンをクリックしたときに画面全体をスライドする機能を追加する必要があります。

これは私のappdelegateが行うことです:

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
   self.window.root = self.tabBarController; //tabBarController is IBOutlet to the tabbar
}

そして、私のviewcontrollerの1つでこれを行います:

- (IBAction)filterButtonTapped:(id)sender {

    [UIView animateWithDuration:0.2 delay:0.0f options:UIViewAnimationOptionCurveEaseInOut  | UIViewAnimationOptionBeginFromCurrentState animations:^{
        //slide everything to the right?
        self.navigationController.view = CGAffineTransformMakeTranslation(260.0f, 0.0f);

    } completion:^(BOOL finished) {
       //do something, possibly show the view that comes up from the left 
    }];

ボタンを contentview 内に配置する必要がある理由を尋ねるかもしれません。なぜなら、私のアプリはそのように設計されているからだと思います。

これで、タブ バーのコンテンツはスライドしますが、下のタブ バーはスライドしません。それは、self.navigationController.view がタブ バー内の contentview 用であるためです。

全体をスライド/アニメーション化する方法を見つけようとしていますが、コンテンツビュー内からルートに到達することは可能ですか?

これを行うためのあなたの提案は何ですか?

4

1 に答える 1

0

を使用して、内部の任意の VC からタブ バー コントローラー ビューにアクセスできます。

self.tabBarController.view

次に、そのビューをアニメーション化します。

于 2012-11-25T18:46:01.413 に答える