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/> <true/>
<key>UIStatusBarHidden~ipad</key> <key>UIStatusBarHidden~ipad</key>
<true/> <true/>
<key>UISupportedInterfaceOrientations</key>
<array>
<string>UIInterfaceOrientationPortrait</string>
<string>UIInterfaceOrientationPortraitUpsideDown</string>
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string>
</array>
<key>UIViewControllerBasedStatusBarAppearance</key> <key>UIViewControllerBasedStatusBarAppearance</key>
<false/> <false/>
</dict> </dict>

View File

@ -689,7 +689,8 @@ void x_init_persistent_path(MyString& hp)
- (void) didRotate:(NSNotification *)notification - (void) didRotate:(NSNotification *)notification
{ {
UIViewController *v = self.primaryViewController; UIViewController *v = self.primaryViewController;
if (v==nil) if (v==nil)
return ; return ;
@ -747,7 +748,8 @@ void x_init_persistent_path(MyString& hp)
return ; return ;
} }
/*
// Gère manuellement la rotation // Gère manuellement la rotation
// Mets les interfaces systèmes (UIAlert) dans le bon mode // Mets les interfaces systèmes (UIAlert) dans le bon mode
@ -764,21 +766,15 @@ void x_init_persistent_path(MyString& hp)
// if (currentRawReading==270) // if (currentRawReading==270)
[[UIApplication sharedApplication] setStatusBarOrientation: UIInterfaceOrientationPortrait]; [[UIApplication sharedApplication] setStatusBarOrientation: UIInterfaceOrientationPortrait];
*/
// Recalcule la zone d'affichage de l'émulateur
// enleve le clavier si une rotation a eu lieu // enleve le clavier si une rotation a eu lieu
if (oldRotate != self.currentRawReading )//&& [self hasSecondary]==false) if (oldRotate != self.currentRawReading )//&& [self hasSecondary]==false)
{ {
[[pManager getEmulatorView].kbdc restoreInput]; [[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]; [UIView setAnimationDuration:0.3];
CGAffineTransform matv = CGAffineTransformIdentity; 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; self.contentView.transform = matv;
@ -560,7 +560,6 @@ int x_lock_zoom = 0;
boundRect.origin.y = 0; boundRect.origin.y = 0;
} }
[self.contentView setBounds:boundRect]; [self.contentView setBounds:boundRect];
} }
@ -576,12 +575,7 @@ int x_lock_zoom = 0;
// l'interface est repositionnées mais non animée // l'interface est repositionnées mais non animée
CGRect uirect = [[UIScreen mainScreen] applicationFrame]; CGRect uirectrotate = [[UIScreen mainScreen] applicationFrame];
CGRect uirectrotate = CGRectApplyAffineTransform(uirect,matv);
uirectrotate.origin.x = 0;
uirectrotate.origin.y = 0;
[self.kbdc updateView:uirectrotate]; [self.kbdc updateView:uirectrotate];
[pManager updateNotificationView:uirectrotate]; [pManager updateNotificationView:uirectrotate];
@ -593,14 +587,31 @@ int x_lock_zoom = 0;
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{ {
return NO; return YES;
} }
- (BOOL)shouldAutorotate - (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 { - (void)didReceiveMemoryWarning {
// Releases the view if it doesn't have a superview. // Releases the view if it doesn't have a superview.

View File

@ -382,6 +382,21 @@
return YES; 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 @end