【问题标题】:How to make transparent background see the home screen? [duplicate]如何让透明背景看到主屏幕? [复制]
【发布时间】:2012-05-30 05:16:55
【问题描述】:

可能重复:
Transparent iphone application

我想做一个用户可以看到主屏幕的应用程序,这意味着该应用程序图标所在的屏幕。谁能告诉如何做到这一点?我试图通过设置来做到这一点:

self.view.backgroundColor=[UIColor clearColor];
self.view.opaque=NO;

但它没有显示透明屏幕。谁能帮帮我?

【问题讨论】:

  • 很有趣,但我怀疑这根本不可能。
  • nhahtdh 是正确的。您只能使您的应用程序主屏幕可见。不是您的手机主屏幕。
  • 如果成功了绝对是个好主意,但如果成功了,肯定有人会惊讶地发现为什么我的主屏幕不可触摸或不可滚动。一段时间后他意识到哦,我忘记了一个应用程序正在运行。跨度>
  • 你尝试设置 window.backgroundColor=[UIColor clearColor];请检查这个
  • Ayaz,我试过了,但是没用。

标签: ios cocoa-touch uiview


【解决方案1】:

不,使用官方 SDK 是不可能的..

编辑:哎呀,经过一番搜索,这个问题似乎是这个one..的副本。

【讨论】:

    【解决方案2】:

    您可以在 appDelegate 中将图像添加到窗口

    UIImage* bgImage = [UIImage imageNamed:@"bg.png"];
    UIImageView* bgView = [[UIImageView alloc]initWithImage:bgImage];
    [self.window addSubview:bgView];
    [bgView release];
    

    然后您可以根据您的要求设置所有视图的背景,默认为clearColor

    [self.view setBackgroundColor:[UIColor colorWithRed:100 green:0 blue:0 alpha:0.1]]; // for red transparent
    
    
    [self.view setBackgroundColor:[UIColor colorWithRed:0 green:100 blue:0 alpha:0.1]]; // for green transparent
    
    
    [self.view setBackgroundColor:[UIColor colorWithRed:0 green:0 blue:100 alpha:0.1]]; // for blue transparent
    

    【讨论】:

      猜你喜欢
      • 2014-06-18
      • 1970-01-01
      • 1970-01-01
      • 2013-09-27
      • 2023-04-06
      • 1970-01-01
      • 1970-01-01
      • 2021-01-31
      • 2013-09-06
      相关资源
      最近更新 更多