Created
March 9, 2013 19:27
-
-
Save bartolsthoorn/5125418 to your computer and use it in GitHub Desktop.
openMainMenu works properly and animates the view in, closeMainMenu does not animate..
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- (void)openMainMenu { | |
_menu_opened = YES; | |
_darknessOverlay.hidden = NO; | |
CGRect oldFrame = _menuView.frame; | |
CGRect f = _menuView.frame; | |
f.origin.x = _menuView.frame.size.width * -1; | |
_menuView.frame = f; | |
_menuView.hidden = NO; | |
[UIView animateWithDuration:0.3 | |
animations:^{ | |
_menuView.frame = oldFrame; | |
}]; | |
[self.leftMenuButton setImage:[UIImage imageNamed:@"home-back"] forState:UIControlStateNormal]; | |
} | |
- (void)closeMainMenu { | |
_menu_opened = NO; | |
_darknessOverlay.hidden = YES; | |
[UIView animateWithDuration:0.3 delay:0 options:UIViewAnimationOptionBeginFromCurrentState | |
animations:^{ | |
CGRect f = _menuView.frame; | |
f.origin.x = _menuView.frame.size.width * -1; | |
_menuView.frame = f; | |
} completion:nil]; | |
[self.leftMenuButton setImage:[UIImage imageNamed:@"home"] forState:UIControlStateNormal]; | |
} | |
- (IBAction)leftMenuButtonTouched:(id)sender { | |
if (_menu_opened == NO) { | |
[self openMainMenu]; | |
} else { | |
[self closeMainMenu]; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment