iOS UIWindow最上层添加视图或者其他控件

    UIView *view = [[UIView alloc]initWithFrame:CGRectMake(self.view.frame.size.width-50,20, 30, 30)];

    view.backgroundColor = [UIColor whiteColor];

    view.layer.masksToBounds =YES;

    view.layer.cornerRadius =15;

    //获取当前UIWindow 并添加一个视图

    UIApplication *ap = [UIApplication sharedApplication];

    [ap.keyWindowaddSubview:view];

 

你可能感兴趣的:(UIWindow,窗口)