Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Callback method for presentViewController

Tags:

ios

I'm having trouble with presentViewController method and its last parameter.

[self presentViewController:navigationController animated:YES completion:nil];

I'm new in objective-c syntax and can't find out what object should I pass to 'completion' parameter. (also didn't find any examples that use it)

I want to have callback method when my presented View Controller dismisses.

Thanks,

Milos

like image 955
Milos Pesic Avatar asked Nov 28 '22 04:11

Milos Pesic


1 Answers

Example of creating a completion block:

[self presentViewController:navigationController 
                   animated:YES 
                 completion:^(){
                     //put your code here
                 }];

This block does not take parameters. other blocks may take parameters and you can define them like this example:

^(BOOL bFinished){
    //put your code here
}
like image 54
Aymarick Avatar answered Dec 09 '22 14:12

Aymarick