2014-01-13 36 views
0

当Splash使用完时间后,我想更改viewController;我有这样的:当Splash完成时更改ViewController

//Implementación de los métodos: 
- (void) cargaImagenes{ 
    //Asginación de ficheros de imagen a las variables 
    splash1 =[[UIImageView alloc] initWithImage:[UIImage imageNamed:@"Ejemplo1.jpg"]]; 
    splash2 =[[UIImageView alloc] initWithImage:[UIImage imageNamed:@"Ejemplo2.jpg"]]; 

    //Ocultamos las imágenes 
    splash1.alpha = 0.0; 
    splash2.alpha = 0.0; 
    //Las ponemos como subvistas a la vista principal del ViewController 
    [self.view addSubview:splash1]; 
    [self.view addSubview:splash2]; 

    // Presentación mediante animación del primer splash. 
    //Dos bloques de código: 1.- Tipo de animación del splash1. 2.- Se ejecuta un timer con un segundo de duración, que cuando termina, se ejecuta el metodo showSecondSplash. 
    [UIView animateWithDuration:0.5 animations:^{ 
     splash1.alpha = 1.0; 
    } completion:^(BOOL finished){ 
     [NSTimer scheduledTimerWithTimeInterval:1.0 target:self selector:@selector(showSecondSplash:) userInfo:nil repeats: NO]; 
    }]; 

} 

-(void) showSecondSplash:(NSTimer *) timer{ 
    //Ocultamos el primer splash, mostramos el segundo splash y programamos un timer para que se oculte el segundo y comience la aplicacion. 
    [UIView animateWithDuration:0.5 animations:^{ 
     splash1.alpha = 0.0; 
     splash2.alpha=1.0; 
    } completion:^(BOOL finished){ 
     [NSTimer scheduledTimerWithTimeInterval:1.0 target:self selector:@selector(finishSplash:) userInfo:nil repeats:NO]; 
    }]; 
} 
-(void) finishSplash:(NSTimer *) timer { 
    //Ocultamos el segundo splash 
    //Eliminamos ambos splash de la vista 
    [UIView animateWithDuration:0.5 animations:^{ 
     splash2.alpha = 0.0; 
    } completion:^(BOOL finished){ 
     [splash1 removeFromSuperview]; 
     [splash2 removeFromSuperview]; 
    }]; 

} 

我想,当它已经完成出现NavigationViewController在我的故事板使用的是飞溅的初步意见,然后NavigationViewController用tableViewController这个视图控制器。 从该视图到NavigationViewController具有模式风格的segue。 如何?谢谢。

回答

1

也许我理解你的问题不是很清楚......

这是你在找什么?

-(void) finishSplash:(NSTimer *) timer { 
    //Ocultamos el segundo splash 
    //Eliminamos ambos splash de la vista 
    [UIView animateWithDuration:0.5 animations:^{ 
     splash2.alpha = 0.0; 
    } completion:^(BOOL finished){ 
     [splash1 removeFromSuperview]; 
     [splash2 removeFromSuperview]; 
     [self performSegueWithIdentifier:@"YourSegueIdentifier" sender:self]; 
    }]; 

} 
相关问题