Pregunta

i made a single view project with storyboard, added a couple of viewcontrollers. the initial viewcontroller has a simple button to display another viewcontroller

- (IBAction)doPhotoAlbumBtn:(id)sender {
    UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"Main.storyboard" 
                                                         bundle:nil];
    VCDecorations *ieVC = 
     [storyboard instantiateViewControllerWithIdentifier:@"VCDecorations"];
    [self presentViewController:ieVC animated:NO completion:nil];
 }

I imported the class, connected the biecontroller in the ib to the right class, have on the viewcontroller the right identifier and checked the "use storyboard ID" checkbox and i feel like im missing smth very basic. help me guys. Thanks.

¿Fue útil?

Solución

If you only want to switch to a UIViewController inside the same storyboard as the current UIViewController is in you can do that with this:

UIViewController *vc = [self.storyboard instantiateViewControllerWithIdentifier:@"ID"];
[self presentViewController:vc animated:NO completion:nil];

EDIT

To pass data you use a block in completion:block, add a property for the object you want to pass things to. The block executes when the animation is done.

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top