// Initialization code
self.backgroundColor = [UIColorclearColor];
_mainWindow = [UIApplicationsharedApplication].keyWindow;
_overlayWindow = [[UIWindow alloc] initWithFrame:SCREENBOUND];
_overlayWindow.windowLevel = UIWindowLevelStatusBar;
_overlayWindow.userInteractionEnabled = NO;
_overlayWindow.backgroundColor = [UIColorcolorWithWhite:0.0falpha:0.0f];
_overlayWindow.hidden = YES;
[_overlayWindowmakeKeyWindow];
- (void)show
{
_overlayWindow.hidden = NO;
[UIViewanimateWithDuration:kDuration*1.5f
delay:0.0f
options:UIViewAnimationOptionCurveEaseOut
animations:^(){
_overlayWindow.backgroundColor = [UIColor colorWithWhite:0.0f alpha:0.35f];
}
completion:^(BOOL finished){
}];
}
- (void)hide
{
[UIViewanimateWithDuration:kDuration*1.5f
delay:0.0f
options:UIViewAnimationOptionCurveEaseOut
animations:^(){
_overlayWindow.backgroundColor = [UIColor colorWithWhite:0.0f alpha:0.0f];
}
completion:^(BOOL finished){
_overlayWindow.hidden = YES;
}];
}
- (void)showInView:(UIView *) view
{
[self show];
[view addSubview:_overlayWindow];
CATransition *animation = [CATransition animation];
animation.delegate = self;
animation.duration = kDuration;
animation.timingFunction = [CAMediaTimingFunctionfunctionWithName:kCAMediaTimingFunctionEaseInEaseOut];
animation.type = kCATransitionPush;
animation.subtype = kCATransitionFromTop;
[self setAlpha:1.0f];
[self.layer addAnimation:animation forKey:@"DDLocateView"];
self.frame = CGRectMake(0, view.frame.size.height - self.frame.size.height, self.frame.size.width, self.frame.size.height);
[view addSubview:self];
}