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 yes
and @ 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
Post a Comment