ios 添加朦层

@interface RootViewController : UIViewController
{  
    UIView        *view;
}

 

-(void)createBackgroundView
{
    view = [[UIView alloc]initWithFrame:self.view.frame];
    view.backgroundColor = [[UIColor blackColor] colorWithAlphaComponent:0.0];
    view.opaque = NO;

UIWindow *appWindow = [[UIApplicationsharedApplication] keyWindow];


[appWindow addSubview:view]; //覆盖全屏


    [self.view addSubview:view];
    [UIView animateWithDuration:0.2 animations:^{
        view.backgroundColor = [[UIColor blackColor] colorWithAlphaComponent:0.25];
    }];
}

 

posted on 2013-08-27 13:01  Hai_阔天空  阅读(337)  评论(0编辑  收藏  举报

导航