what should go into completion in presentViewController? what should go into completion in presentViewController? ios ios

what should go into completion in presentViewController?


You can use the below code instead:

[self presentViewController:second animated:YES completion:^{ }];

or you can simply pass NULL

[self presentViewController:second animated:YES completion:NULL];

The completion block is used for doing any tasks after presenting the view controller , the code written inside the completion block will execute only after the view is presented.


@try this

[self presentViewController:second animated:YES completion:^{[self animationCompleted];}];-(void)animationCompleted{   // Whatever you want to do after finish animation    NSLog(@"Animation Completed")}

if you don't want to do anything on completion of animation

[self presentViewController:second animated:YES completion:NULL];


You can use the following code for the presenting the view

  [[self navigationController] dismissViewControllerAnimated:YES completion:NULL];

Following is the code for the that

SecondViewController *second = [[SecondViewController alloc] initWithNibName:@"SecondViewController" bundle:nil];[self presentViewController:second animated:YES completion:nil];

For more detail check the apple forum discussion