0

サブビューでフリップの動きが必要です。次の方法では、サブビューを変更しますが、フリップアニメーションは使用しません....

    int tag=g.view.tag;
    UIViewController* vc2 = [controlersOfTableBoxes objectAtIndex:tag-1];

    UIView* viewOfSelf = self.view;
    UIViewController* v = [[UIViewController alloc] init];

    [UIView beginAnimations:nil context:NULL];
    [UIView setAnimationDuration:1.0];
    [UIView setAnimationDelegate:self];
    [UIView setAnimationTransition:UIViewAnimationTransitionFlipFromRight forView:v.view cache:NO];

    int maxGraphs = [[viewOfSelf subviews] count];

    for (int i = 0; i < maxGraphs; i++ ) 
    {
        if([[[viewOfSelf subviews] objectAtIndex:i]  isKindOfClass:[UIView class]])
        {
            UIView* v = [[viewOfSelf subviews] objectAtIndex:i];
            if(v.tag==tag)
            {
                 [[[viewOfSelf subviews] objectAtIndex:i] removeFromSuperview];
               break;   
            }
        }
    }
    [viewOfSelf addSubview:vc2.view];
    v.view = viewOfSelf;

    [UIView commitAnimations];

この行を変更すると:

[UIView setAnimationTransition:UIViewAnimationTransitionFlipFromRight forView:v.view cache:NO];

為に

[UIView setAnimationTransition:UIViewAnimationTransitionFlipFromRight forView:self.view cache:NO];

動きは画面全体ですが、サブビューコントローラーのサブビューのみが必要です。

私はこの方法を試みます:

 [UIView animateWithDuration:0.5f delay:0.0f options:UIViewAnimationTransitionFlipFromRight animations:^(void) 
     { 
         int tag=g.view.tag;
         UIViewController* vc2 = [controlersOfTableBoxes objectAtIndex:tag-1];

         UIView* viewOfSelf = self.view;
         UIViewController* v = [[UIViewController alloc] init];
         int maxGraphs = [[viewOfSelf subviews] count];

         for (int i = 0; i < maxGraphs; i++ ) 
         {
             if([[[viewOfSelf subviews] objectAtIndex:i]  isKindOfClass:[UIView class]])
             {
                 UIView* view = [[viewOfSelf subviews] objectAtIndex:i];
                 if(view.tag==tag)
                 {
                     v.view=view;
                     [[[viewOfSelf subviews] objectAtIndex:i] removeFromSuperview];
                     break;   
                 }
             }
         }
         [viewOfSelf addSubview:vc2.view];
         v.view = viewOfSelf;
     } 
     completion:^(BOOL finished) 
     {}];

しかし、結果は同じです...

4

1 に答える 1

0

あなたが使用することができます

[UIView beginAnimations:nil context:NULL];
[UIView setAnimationDuration:5];
[UIView transitionFromView:view2 toView:view1 duration:3 options:UIViewAnimationOptionTransitionFlipFromBottom completion:NULL];
[UIView commitAnimations];

私を試してみてください

nt tag=g.view.tag;
 UIViewController* v = [controlersOfBoxes objectAtIndex:tag-1];
 UIViewController* vc2 = [controlersOfTableBoxes objectAtIndex:tag-1];
 [UIView transitionWithView:vc2.view duration:0.5 options:UIViewAnimationOptionTransitionFlipFromLeft animations:^ { [v.view removeFromSuperview]; [self.view addSubview:vc2.view]; } completion:nil];
于 2012-05-16T09:38:19.747 に答える