improved orientation support on ios8

This commit is contained in:
Olivier Goguel 2016-03-28 21:18:27 +02:00
parent 6c0be03349
commit 7b16315809
4 changed files with 50 additions and 21 deletions

View File

@ -40,6 +40,13 @@
<true/>
<key>UIStatusBarHidden~ipad</key>
<true/>
<key>UISupportedInterfaceOrientations</key>
<array>
<string>UIInterfaceOrientationPortrait</string>
<string>UIInterfaceOrientationPortraitUpsideDown</string>
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string>
</array>
<key>UIViewControllerBasedStatusBarAppearance</key>
<false/>
</dict>

View File

@ -690,6 +690,7 @@ void x_init_persistent_path(MyString& hp)
{
UIViewController *v = self.primaryViewController;
if (v==nil)
return ;
@ -748,6 +749,7 @@ void x_init_persistent_path(MyString& hp)
}
/*
// Gère manuellement la rotation
// Mets les interfaces systèmes (UIAlert) dans le bon mode
@ -764,21 +766,15 @@ void x_init_persistent_path(MyString& hp)
// if (currentRawReading==270)
[[UIApplication sharedApplication] setStatusBarOrientation: UIInterfaceOrientationPortrait];
// Recalcule la zone d'affichage de l'émulateur
*/
// enleve le clavier si une rotation a eu lieu
if (oldRotate != self.currentRawReading )//&& [self hasSecondary]==false)
{
[[pManager getEmulatorView].kbdc restoreInput];
//[[pManager getEmulatorView].kbdc hideInput];
// [[pManager getEmulatorView].kbdc enableKeyboard:FALSE];
}
[[pManager getEmulatorView] updateView ];
// [[pManager getEmulatorView] updateView ];
}

View File

@ -467,7 +467,7 @@ int x_lock_zoom = 0;
[UIView setAnimationDuration:0.3];
CGAffineTransform matv = CGAffineTransformIdentity;
matv = CGAffineTransformRotate (matv,(270-[pManager getAngle])*M_PI/180); //Avec
// matv = CGAffineTransformRotate (matv,(270-[pManager getAngle])*M_PI/180); //Avec
self.contentView.transform = matv;
@ -560,7 +560,6 @@ int x_lock_zoom = 0;
boundRect.origin.y = 0;
}
[self.contentView setBounds:boundRect];
}
@ -576,12 +575,7 @@ int x_lock_zoom = 0;
// l'interface est repositionnées mais non animée
CGRect uirect = [[UIScreen mainScreen] applicationFrame];
CGRect uirectrotate = CGRectApplyAffineTransform(uirect,matv);
uirectrotate.origin.x = 0;
uirectrotate.origin.y = 0;
CGRect uirectrotate = [[UIScreen mainScreen] applicationFrame];
[self.kbdc updateView:uirectrotate];
[pManager updateNotificationView:uirectrotate];
@ -593,14 +587,31 @@ int x_lock_zoom = 0;
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
return NO;
return YES;
}
- (BOOL)shouldAutorotate
{
return NO;
return YES;
}
// IOS 8
- (NSUInteger)supportedInterfaceOrientations {
return UIInterfaceOrientationMaskAll;
}
- (void)viewWillTransitionToSize:(CGSize)size withTransitionCoordinator:(id<UIViewControllerTransitionCoordinator>)coordinator
{
[super viewWillTransitionToSize:size withTransitionCoordinator:coordinator];
[coordinator animateAlongsideTransition:^(id<UIViewControllerTransitionCoordinatorContext> context) {
[self updateView];
} completion:^(id<UIViewControllerTransitionCoordinatorContext> context) {
}];
}
- (void)didReceiveMemoryWarning {
// Releases the view if it doesn't have a superview.

View File

@ -382,6 +382,21 @@
return YES;
}
// IOS 8
- (NSUInteger)supportedInterfaceOrientations {
return UIInterfaceOrientationMaskAll;
}
- (void)viewWillTransitionToSize:(CGSize)size withTransitionCoordinator:(id<UIViewControllerTransitionCoordinator>)coordinator
{
[super viewWillTransitionToSize:size withTransitionCoordinator:coordinator];
[coordinator animateAlongsideTransition:^(id<UIViewControllerTransitionCoordinatorContext> context) {
[self updateView];
} completion:^(id<UIViewControllerTransitionCoordinatorContext> context) {
}];
}
@end