自定义弹框遮住导航和Tabbar

创建弹框:

/* 遮罩window */
@property(nonatomic,strong)UIWindow *coverWindow;
/* 弹框 */
@property(nonatomic,strong)UIView *alertView;

-(UIView *)alertView
{
    if (!_alertView) {
        _alertView = [[UIView alloc]initWithFrame:CGRectMake(50, (kScreenHeight-150)*0.5, kScreenWidth-100, 150)];
        _coverWindow = [[UIWindow alloc]initWithFrame:CGRectMake(0, 0, kScreenWidth, kScreenHeight)];
        _coverWindow.backgroundColor = [UIColor colorWithWhite:0 alpha:0.4];
        
        _alertView.clipsToBounds = YES;
        _alertView.layer.cornerRadius = 4;
        [_coverWindow addSubview:_alertView];
        _coverWindow.windowLevel = UIWindowLevelNormal;
        _coverWindow.hidden = YES;
        [[UIApplication sharedApplication].keyWindow addSubview:_coverWindow];
    }
    return _alertView;
}



显示弹框

self.alertView.hidden = NO;
        self.coverWindow.hidden = NO;

隐藏弹框

self.alertView.hidden = YES;
    self.coverWindow.hidden = YES;


阅读更多
版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/Leemin_ios/article/details/53992985
个人分类: iOS
上一篇iOS-设置按钮高亮的背景颜色
下一篇iOS微博个人主页
想对作者说点什么? 我来说一句

没有更多推荐了,返回首页

关闭
关闭