123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384 |
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- #import "SidebarFacebookAnimation.h"
-
- @implementation SidebarFacebookAnimation
-
- + (void)animateContentView:(UIView *)contentView sidebarView:(UIView *)sidebarView fromSide:(Side)side visibleWidth:(CGFloat)visibleWidth duration:(NSTimeInterval)animationDuration completion:(void (^)(BOOL))completion
- {
- [self resetSidebarPosition:sidebarView];
- [self resetContentPosition:contentView];
-
-
- CGRect contentFrame = contentView.frame;
-
- if(side == LeftSide)
- {
- contentFrame.origin.x += visibleWidth;
- }
- else
- {
- contentFrame.origin.x -= visibleWidth;
- }
-
- UIView *overlayContentView = [self overlayContentView:contentView.bounds];
- [contentView addSubview:overlayContentView];
-
- [UIView animateWithDuration:animationDuration
- delay:0.0
- options:UIViewAnimationOptionCurveEaseInOut
- animations:^{
- contentView.frame = contentFrame;
- overlayContentView.backgroundColor = [self overlayContentColor];
- }
- completion:^(BOOL finished) {
- completion(finished);
- }];
- }
-
-
- + (void)reverseAnimateContentView:(UIView *)contentView sidebarView:(UIView *)sidebarView fromSide:(Side)side visibleWidth:(CGFloat)visibleWidth duration:(NSTimeInterval)animationDuration completion:(void (^)(BOOL))completion
- {
- CGRect contentFrame = contentView.frame;
- contentFrame.origin.x = 0;
-
- UIView *overlayContentView = [self overlayContentView:contentView.bounds];
- [contentView addSubview:overlayContentView];
-
- [UIView animateWithDuration:animationDuration
- delay:0.0
- options:UIViewAnimationOptionCurveEaseInOut
- animations:^{
- contentView.frame = contentFrame;
- overlayContentView.backgroundColor = [UIColor clearColor];
- }
- completion:^(BOOL finished) {
- completion(finished);
- [overlayContentView removeFromSuperview];
- }];
- }
-
- @end
|