The documentation mentions adding shadows to the controller being animated to show the slide menu. However, instead of a shadow I would like to make the animated view controller to be darker. Is this possible?
I simply created a masking view and presented/removed it on notifications from the slidingviewcontroller. Added some nice fade in and fade out action for effect :) Hope this helps
#import <UIKit/UIKit.h>
UIView *overLayView;
@interface MyViewController : UIViewController {
UIView *overLayView;
}
@end
@implementation MyViewController
- (void)viewDidLoad
{
[super viewDidLoad];
overLayView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, self.view.frame.size.width, self.view.frame.size.height)];
overLayView.backgroundColor = [UIColor blackColor];
}
-(void) viewWillAppear:(BOOL)animated{
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(disableView) name:ECSlidingViewUnderLeftWillAppear object:nil];
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(enableView) name:ECSlidingViewTopWillReset object:nil];
}
- (void)viewWillDisappear:(BOOL)animated{
[[NSNotificationCenter defaultCenter] removeObserver:self name:ECSlidingViewUnderLeftWillAppear object:nil];
[[NSNotificationCenter defaultCenter] removeObserver:self name:ECSlidingViewTopWillReset object:nil];
}
-(void) disableView {
overLayView.alpha = 0;
[self.view addSubview:overLayView];
[UIView animateWithDuration:0.5 animations:^{
overLayView.alpha += kViewHelperUIViewMaskAlpha;
}];
}
-(void) enableView {
[UIView animateWithDuration:0.5 animations:^{
overLayView.alpha -= kViewHelperUIViewMaskAlpha;
} completion:^(BOOL fin){
if(fin){
[overLayView removeFromSuperview];
}
}];
}
@end