Start a new topic

Lock screen orientation

Lock screen orientation


Hi there,

  Is there any way to lock the screen orientation in wikitude webview? Cuz ratation will cause some problem, my situation is like this.

  My phonegap version is 3.3, with latest wikitude plugin

Hi,
you can lock the the screen rotation to portrait by simply replacing lines 121to 145 form WTARViewController with the following snippet:

#pragma mark - Orientation handling iOS 6

 

- (BOOL)shouldAutorotate

{

    return YES;

}

 

- (NSUInteger)supportedInterfaceOrientations

{

    return UIInterfaceOrientationMaskPortrait;

}

 

#pragma mark Orientation handling iOS 5

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation

{

    return UIInterfaceOrientationIsPortrait(toInterfaceOrientation);

}

 

#pragma mark Orientation handling Wikitude

- (void)willRotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)duration

{

    BOOL shouldRotate = UIInterfaceOrientationIsPortrait(toInterfaceOrientation);

    

    ;

}

 

Best regards
Andreas

Hi Andreas, 

  Thank you a looot! 

You're welcome!
We will release a new PhoneGap Plugin within the next few days where the orientation handling is solved in a more generic way, so stay tuned for upcoming updates!

Best regards

Andreas

Wow, exciting!!

Before the update released, is there any way to do the same modification on Android? Sorry for another demanding, I have to fix this for a demonstration on the day after tomorrow 

Hi there!

You may update AndroidManifest accordingly to force landscape/portrait mode.

Kind regards,
Andreas

Thanks again!
Login or Signup to post a comment