Add a UIView above all, even the navigation bar

前端 未结 17 1675
悲&欢浪女
悲&欢浪女 2020-11-29 15:36

I want to display, above any other views, even the navigation bar, a kind of \"pop-up\" view that looks like this:

  • full screen black background with a 0.5 alph
17条回答
  •  旧巷少年郎
    2020-11-29 16:05

    [self.navigationController.navigationBar.layer setZPosition:-0.1];
    UIView *view = [[UIView alloc]initWithFrame:CGRectMake(10, 20, 35, 35)];
    [view setBackgroundColor:[UIColor redColor]];
    [self.navigationController.view addSubview:view];
    [self.navigationController.view bringSubviewToFront:view];
    self.navigationController.view.clipsToBounds = NO;
    [self.navigationController.navigationBar.layer setZPosition:0.0];
    

提交回复
热议问题