Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Fix bug in action menu, the initial display was broken

  • Loading branch information...
commit fd206b2865ab2acc972dc6aaf8136693ea1997d2 1 parent 4683b69
Richard Moreland richard authored
Showing with 9 additions and 4 deletions.
  1. +9 −4 Classes/Outline/ActionMenuController.m
13 Classes/Outline/ActionMenuController.m
View
@@ -106,7 +106,7 @@ - (void)onCancel {
[self close];
}
-- (void)layoutButtons {
+- (void)layoutButtons:(UIDeviceOrientation)orientation {
int halfButtonWidth = 130;
int fullButtonWidth = 280;
int buttonHeight = 40;
@@ -116,7 +116,7 @@ - (void)layoutButtons {
int rightButtonX = 0;
int yOffset = 0;
- switch ([[UIDevice currentDevice] orientation]) {
+ switch (orientation) {
case UIDeviceOrientationFaceUp:
case UIDeviceOrientationFaceDown:
case UIDeviceOrientationUnknown:
@@ -178,11 +178,16 @@ - (void)loadView {
[self.view addSubview:actionView];
- [self layoutButtons];
+ // Perform an initial layout just to get all the buttons situated as if we're in Portrait mode
+ // This will handle cases where the device is in an indeterminate state
+ [self layoutButtons:UIDeviceOrientationPortrait];
+
+ // Then perform a real layout to handle the current orientation
+ [self layoutButtons:[[UIDevice currentDevice] orientation]];
}
- (void)didRotate:(NSNotification *)notification {
- [self layoutButtons];
+ [self layoutButtons:[[UIDevice currentDevice] orientation]];
}
- (UILabel*)titleField {
Please sign in to comment.
Something went wrong with that request. Please try again.