ios - Setting supported interface orientation as 'All' only MPMoviePlayerController is active in swift -


i trying set interface orientation mpmovieplayercontroller active. meanwhile, movie started play. in target of project, have checked portrait, landscape left , landscape right. also, in appdelegate file, have implemented supportedinterfaceorientationsforwindow method , tried check presentedviewcontroller mpmovieplayercontroller. however, not implement correctly. how can solve problem correct way ? best solution changing supported interface orientation when mpmovieplayercontroller active ?

thank answers

king regards

you need uiinterfaceorientationmaskall only mpmovieplayercontroller so, while creating controller use bool variable identify interface needed or not .

mpmovieplayerviewcontroller *playercontroller = [[mpmovieplayerviewcontroller alloc] initwithcontenturl:[nsurl fileurlwithpath:moviepath]]; 

override initwithcontenturl method , set appdelegate bool variable yesand @ viewwilldisappear set bool no.

in appdelegate.m

#pragma mark --- orientation changes movie  -(nsuinteger)application:(uiapplication *)application supportedinterfaceorientationsforwindow:(uiwindow *)window{  if (self.orientationneeded) {     return  uiinterfaceorientationmaskall; } return uiinterfaceorientationmaskportrait; } 

the flow perfect ,first init method called , have setted bool variable , supportedinterfaceorientationsforwindow method called , revert bool when view out.


Comments

Popular posts from this blog

javascript - Using jquery append to add option values into a select element not working -

Android soft keyboard reverts to default keyboard on orientation change -

jquery - javascript onscroll fade same class but with different div -