0

I have a subclass of UIViewController. In order to present an alert in its instance method I would do

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

This time I need to present this alert in a class level method. There is no known class method for selector 'presentViewController:animated:completion:'

Is there any workaround?

Willeke
  • 14,578
  • 4
  • 19
  • 47
Alex
  • 81
  • 6
  • Find some view controller that suits your purpose and present in that. For example: https://stackoverflow.com/questions/6131205/how-to-find-topmost-view-controller-on-ios – Roope May 30 '20 at 15:43
  • @Roope Thanks. This is a good idea to find topmost controller from a class level method. – Alex Jun 02 '20 at 15:54

0 Answers0