Fix rotation for Info & Detail View

This commit is contained in:
Olivier Goguel 2016-04-02 22:03:47 +02:00
parent a01ef5862f
commit d25074b7a7
5 changed files with 52 additions and 29 deletions

View File

@ -540,7 +540,7 @@
09FA607C125A7B3E00B07F77 /* activegsList.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = activegsList.mm; sourceTree = "<group>"; }; 09FA607C125A7B3E00B07F77 /* activegsList.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = activegsList.mm; sourceTree = "<group>"; };
09FA607D125A7B3E00B07F77 /* activegsViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = activegsViewController.h; sourceTree = "<group>"; }; 09FA607D125A7B3E00B07F77 /* activegsViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = activegsViewController.h; sourceTree = "<group>"; };
09FA607E125A7B3E00B07F77 /* activegsViewController.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = activegsViewController.mm; sourceTree = "<group>"; }; 09FA607E125A7B3E00B07F77 /* activegsViewController.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = activegsViewController.mm; sourceTree = "<group>"; };
09FA607F125A7B3E00B07F77 /* activegsViewController.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = activegsViewController.xib; sourceTree = "<group>"; }; 09FA607F125A7B3E00B07F77 /* activegsViewController.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = activegsViewController.xib; path = ../Common.iphone/activegsViewController.xib; sourceTree = "<group>"; };
09FA6082125A7B3E00B07F77 /* asyncimageview.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = asyncimageview.h; sourceTree = "<group>"; }; 09FA6082125A7B3E00B07F77 /* asyncimageview.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = asyncimageview.h; sourceTree = "<group>"; };
09FA6083125A7B3E00B07F77 /* asyncimageview.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = asyncimageview.mm; sourceTree = "<group>"; }; 09FA6083125A7B3E00B07F77 /* asyncimageview.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = asyncimageview.mm; sourceTree = "<group>"; };
09FA6086125A7B3E00B07F77 /* GTMUIView+SubtreeDescription.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "GTMUIView+SubtreeDescription.h"; sourceTree = "<group>"; }; 09FA6086125A7B3E00B07F77 /* GTMUIView+SubtreeDescription.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "GTMUIView+SubtreeDescription.h"; sourceTree = "<group>"; };
@ -708,6 +708,7 @@
09B8EB85163B2C06000A9F6B /* xib */ = { 09B8EB85163B2C06000A9F6B /* xib */ = {
isa = PBXGroup; isa = PBXGroup;
children = ( children = (
09FA607F125A7B3E00B07F77 /* activegsViewController.xib */,
0916BB03129473CE001727AF /* infoViewController-ipad.xib */, 0916BB03129473CE001727AF /* infoViewController-ipad.xib */,
09A5CE75125D422D0018DC22 /* infoViewController.xib */, 09A5CE75125D422D0018DC22 /* infoViewController.xib */,
099CD904125E6F6E008EFD6C /* detailViewController.xib */, 099CD904125E6F6E008EFD6C /* detailViewController.xib */,
@ -974,7 +975,6 @@
09FA607C125A7B3E00B07F77 /* activegsList.mm */, 09FA607C125A7B3E00B07F77 /* activegsList.mm */,
09FA607D125A7B3E00B07F77 /* activegsViewController.h */, 09FA607D125A7B3E00B07F77 /* activegsViewController.h */,
09FA607E125A7B3E00B07F77 /* activegsViewController.mm */, 09FA607E125A7B3E00B07F77 /* activegsViewController.mm */,
09FA607F125A7B3E00B07F77 /* activegsViewController.xib */,
09FA6082125A7B3E00B07F77 /* asyncimageview.h */, 09FA6082125A7B3E00B07F77 /* asyncimageview.h */,
09FA6083125A7B3E00B07F77 /* asyncimageview.mm */, 09FA6083125A7B3E00B07F77 /* asyncimageview.mm */,
09FA6086125A7B3E00B07F77 /* GTMUIView+SubtreeDescription.h */, 09FA6086125A7B3E00B07F77 /* GTMUIView+SubtreeDescription.h */,

View File

@ -738,7 +738,7 @@ void x_init_persistent_path(MyString& hp)
curOrientation = orientation; curOrientation = orientation;
NSLog(@"didRotate"); NSLog(@"didRotate");
/*
if (self.primaryViewController != [pManager getEmulatorView]) if (self.primaryViewController != [pManager getEmulatorView])
{ {
if (self.primaryViewController == [pManager getBrowserView]) if (self.primaryViewController == [pManager getBrowserView])
@ -748,6 +748,8 @@ void x_init_persistent_path(MyString& hp)
return ; return ;
} }
*/
/* /*
// Gère manuellement la rotation // Gère manuellement la rotation

View File

@ -114,19 +114,35 @@
} }
// IOS 5 Compatibility // IOS 5 Compatibility
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{ {
return YES; return YES;
} }
// IOS6
- (BOOL)shouldAutorotate - (BOOL)shouldAutorotate
{ {
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) {
}];
}

View File

@ -20,7 +20,8 @@
@property (nonatomic, strong) IBOutlet UIView* portraitView; @property (nonatomic, strong) IBOutlet UIView* portraitView;
@property (nonatomic, strong) IBOutlet UIView* landscapeView; @property (nonatomic, strong) IBOutlet UIView* landscapeView;
- (void)updateView:(UIDeviceOrientation)_orientation ; //- (void)updateView:(UIDeviceOrientation)_orientation ;
- (void)updateView ;
- (IBAction) doneButton:(id)_sender; - (IBAction) doneButton:(id)_sender;
- (IBAction) parametersButton:(id)_sender; - (IBAction) parametersButton:(id)_sender;
- (IBAction) emailButton:(id)_sender; - (IBAction) emailButton:(id)_sender;

View File

@ -55,8 +55,14 @@
} }
/*
-(void)updateView:(UIDeviceOrientation)_orientation
{
}
*/
-(void)updateView:(UIDeviceOrientation)_orientation -(void)updateView
{ {
debug_printf("updateView infoViewController"); debug_printf("updateView infoViewController");
@ -68,26 +74,8 @@
else else
self.view = self.landscapeView; self.view = self.landscapeView;
// self.view = self.portraitView; self.view = self.portraitView;
CGAffineTransform matv = CGAffineTransformIdentity;
matv = CGAffineTransformRotate (matv,(270-[pManager getAngle])*M_PI/180); //Avec
self.view.transform = matv;
CGRect rv2 = [[UIScreen mainScreen] applicationFrame];
CGRect rv3 = CGRectApplyAffineTransform(rv2,matv);
rv3.origin.x = 0;
rv3.origin.y = 0;
[self.view setBounds:rv3];
CGRect rscreen = [[UIScreen mainScreen] applicationFrame];
CGRect vscreen = self.view.frame;
vscreen.origin.x = (rscreen.size.width - self.view.frame.size.width)/2;
vscreen.origin.y = (rscreen.size.height-self.view.frame.size.height)/2;
[self.view setFrame:vscreen];
// pour réactiver les gestures // pour réactiver les gestures
[self viewDidAppear:FALSE]; [self viewDidAppear:FALSE];
@ -134,12 +122,28 @@
- (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) {
}];
} }
@end @end