iOS 半透明控制器

方式一:(创建简单,可控制性小)

    MyController *myVC = [[MyController alloc] init];

    myVC.modalPresentationStyle = UIModalPresentationOverFullScreen;
//    UIView *image =  [[UIApplication sharedApplication].keyWindow snapshotViewAfterScreenUpdates:YES];
//    image.backgroundColor=[UIColor blackColor];
//    image.alpha = 0.0;
//    [myVC.view insertSubview:image atIndex:0];

    [self presentViewController:myVC animated:NO completion:^{
//        image.alpha = 0.1;
    }];

子控制器写上:

- (void)viewDidAppear:(BOOL)animated{
    [super viewDidAppear:animated];
    self.view.alpha = 0.98;

方式二:
就是popover方式的:demo在码云上面,不贴链接。

你可能感兴趣的:(Xcode-小知识点)