0

I tried this to get the current view controller and check if its a kind of class of MPMoviePlayerController or not but it always returns the last view controller before the MPMoviePlayerController.

[self.window.rootViewController.presentedViewController.childViewControllers firstObject]

so how to check if the presented controller is a MPMoviePlayerController?

Iman
  • 1,097
  • 2
  • 11
  • 19

1 Answers1

0

Firstly I think it should be MPMoviePlayerViewController and not MPMoviePlayerController when it is the view controller that you are trying to check here.

If that is correct then once you present the MPMoviePlayerViewController via

[self presentMoviePlayerViewControllerAnimated:movieplayer]; // movieplayer being your MPMoviePlayerViewController's instance

then you should be able to verify the present viewcontroller via

[[self presentedViewController] isKindOfClass:[MPMoviePlayerViewController class]]; // will return true
Vijay Tholpadi
  • 2,135
  • 1
  • 15
  • 20