0
回答
界面之间的无法正常跳转
华为云4核8G,高性能云服务器,免费试用   

蓝色界面和黄色界面之间的跳转,但只显示蓝色界面,黄色界面无法显示,请各位大师指教!!谢谢! 代码如下:

-(IBAction)switchViews:(id)sender{

    [UIView beginAnimations:@"View Flip" context:nil];

    [UIView setAnimationDuration:1.25];

    [UIView setAnimationCurve:UIViewAnimationCurveEaseInOut];

    

    if (self.yellowViewController.view.superview == nil)

    {

    if(self.yellowViewController==nil)

    {

        YellowViewController *yellowController=[[YellowViewController alloc] initWithNibName:@"yellowViewController" bundle:nil];

        self.yellowViewController=yellowController;

        [yellowController release];

    }

    [UIView setAnimationTransition:

     UIViewAnimationTransitionFlipFromRight

                           forView:self.view cache:YES];

    [blueViewController viewWillAppear:YES];

    [yellowViewController viewWillDisappear:YES];

    [blueViewController.view removeFromSuperview];

    [self.view insertSubview:yellowViewController.view atIndex:0];

    [yellowViewController viewDidDisappear:YES];

    [blueViewController viewDidAppear:YES];

    }else if(self.blueViewController.view.superview==nil){

        if (self.blueViewController == nil)

        {

            BlueViewController *blueController =

            [[BlueViewController alloc] initWithNibName:@"BlueViewController"

                                                 bundle:nil];

            self.blueViewController = blueController;

            [blueController release];

        }

        [UIView setAnimationTransition:

         UIViewAnimationTransitionFlipFromLeft

                               forView:self.view cache:YES];

        

        [yellowViewController viewWillAppear:YES];

        [blueViewController viewWillDisappear:YES];

        

        [yellowViewController.view removeFromSuperview];

        [self.view insertSubview:blueViewController.view atIndex:0];

        [blueViewController viewDidDisappear:YES];

        [yellowViewController viewDidAppear:YES];

    }

    [UIView commitAnimations];

}


举报
pdz19900
发帖于5年前 0回/126阅
顶部