ios - How to set the mpMoviePlayerController orientation locked to landscape mode? -


in project,i have set orientation lock should run in portrait mode.i want mpmovieplayer rotate landscape mode once rotated landscape , remain in landscape mode until user click "done " button.

now player rotate landscape in fullscreen , when rotate portrait mode,the player rotate portrait mode in full screen , further rotations not effected player.it remain in portrait fullscreen mode.

any idea??

this requirement..:i want mpmovieplayer rotate landscape mode once rotated landscape , remain in landscape mode until user click "done " button.

any suggestion??thanks in advance..

first of put in viewcontroller plays video:

- (bool)shouldautorotate {     return yes; } 

then implement methods force desired orientation or whatever orientations want:

- (void)forceorientationportrait {     [[uidevice currentdevice] setvalue:[nsnumber numberwithint:uiinterfaceorientationportrait] forkey:@"orientation"]; }  - (void)forceorientationlandscape {     [[uidevice currentdevice] setvalue:[nsnumber numberwithint:uiinterfaceorientationlandscapeleft] forkey:@"orientation"]; } 

last add observers when movieplayer goes fullscreen , when exits. observers trigger before mentioned orientation change methods:

- (void)viewdidload {     [super viewdidload];     // additional setup after loading view, typically nib.      [[nsnotificationcenter defaultcenter] addobserver:self selector:@selector(forceorientationlandscape) name:mpmovieplayerdidenterfullscreennotification object:nil];      [[nsnotificationcenter defaultcenter] addobserver:self selector:@selector(forceorientationportrait) name:mpmovieplayerdidexitfullscreennotification object:nil]; } 

all put should this:

completecode

i hope can accomplish goals.

-- edit --

if want lock orientation after forcing device portrait/landscape implement boolean sets shouldautorotate method accordingly. try this:

orientationboolean


Comments

Popular posts from this blog

javascript - AngularJS custom datepicker directive -

javascript - jQuery date picker - Disable dates after the selection from the first date picker -