欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

显示一个透明背景的ViewController在另一个ViewController上

程序员文章站 2024-01-14 22:38:16
...
    FirstViewController.m

    UIViewController *vc = [SecondViewController init];
    vc.view.backgroundColor = [UIColor clearColor];

    self.modalPresentationStyle = UIModalPresentationCurrentContext;/*设置这个属性背景就是透明的,而不是黑色的了*/

    [self presentModalViewController:vc animated:NO];

版权声明:本文为博主原创文章,未经博主允许不得转载。

转载于:https://www.cnblogs.com/zsw-1993/archive/2012/10/26/4880716.html