If you want to have some code run after your modal view controller has been presented, use -[ UIViewController presentViewController:animated:completion:]
and pass a block to the 'completion' argument.
(This method is the replacement for presentModalViewController:animated:
)
Change your code to:
-(IBAction)onPressed:(id)sender
{
MyViewController * controller = [ [ MyViewController alloc ] initWithNibName:@"MyViewController" bundle:nil ];
controller.delegate = self;
[ self presentViewController:controller animated:YES completion:^{
[ self doMyWork ] ;
}]
}