【问题标题】:Why and how is this transparent portion shown as opaque in iPhone App?为什么以及如何在 iPhone 应用程序中显示为不透明的透明部分?
【发布时间】:2014-05-02 21:59:18
【问题描述】:

请查看下图。

如果您看到,在蓝色对话气泡的黑色轮廓下方,显示的是天蓝色部分。 我正在为蓝色语音气泡使用透明 png。所以,不确定这个天蓝色部分来自哪里。

请是我使用的语音气泡的透明 PNG。

这里有什么问题?

 UIView* popoverView1;
 UIViewController* popoverContent;
    UIImageView *imagebackground;
@property (nonatomic,retain) IBOutlet UIPopoverController *pc;

popoverContent = [[UIViewController alloc]init];
        popoverView1 = [[UIView alloc]initWithFrame:CGRectMake(56,0,393,444)];
       // popoverView1.backgroundColor = [UIColor whiteColor];
        imagebackground = [[UIImageView alloc]initWithFrame:CGRectMake(0,0,393,444)];
        [imagebackground setImage:[UIImage imageNamed:@"card-creation-screen15.png"]];
        [popoverView1 addSubview:btndone];
        [popoverView1 addSubview:btn];
        popoverContent.view = popoverView1;
        [btndone setHidden:YES];

        [popoverView1 addSubview:imagebackground];
        [popoverView1 bringSubviewToFront:btn];
        [popoverView1 bringSubviewToFront:btndone];


        popoverController.backgroundColor = [UIColor clearColor];
        popoverView1.backgroundColor = [UIColor clearColor];
        popoverContent.contentSizeForViewInPopover = CGSizeMake(393, 444);
        pc = [[UIPopoverController alloc]                                                 initWithContentViewController:popoverContent];
        [pc presentPopoverFromRect:CGRectMake(20,650,131,131) inView:self.view                                  permittedArrowDirections:UIPopoverArrowDirectionDown
                          animated:YES];
        pc.backgroundColor = [UIColor clearColor];

 popoverController.backgroundColor = [UIColor clearColor];
    popoverView1.backgroundColor = [UIColor clearColor];
    pc.backgroundColor = [UIColor clearColor];

【问题讨论】:

  • 相关代码在哪里?
  • 你试过设置你的imageview(imagebackground)的背景颜色吗?
  • 是的,我给了它清晰的颜色
  • 我在显示的代码中找不到。这就是我问的原因。

标签: ios iphone objective-c ios7 png


【解决方案1】:

您的 popoverview1 视图有一个白色的backgroundColor,无论如何都应该是[UIColor clearColor]; - 因此,您还会在图像顶部看到一个小的白色边框。从你提供的信息中我无法解释渐变的来源。

【讨论】:

  • 你应该改变你的示例代码,它仍然显示白色。
  • 顺便说一句:您显示的图像不是屏幕截图中使用的图像 - 它是水平翻转的。你确定你使用了正确的图片吗?
  • 顺便说一句:您确实意识到弹出框控制器有一个自己的箭头,它在您的图像中的箭头之外显示?也许您应该将弹出框的想法作为一个整体放弃,并将其实现为您在主视图顶部显示的 UIView,甚至可能作为主视图控制器中使用的 UIViewController(查找“容器”)?
猜你喜欢
  • 2011-06-22
  • 1970-01-01
  • 1970-01-01
  • 2012-04-26
  • 1970-01-01
  • 1970-01-01
  • 2014-09-30
  • 2021-11-25
  • 1970-01-01
相关资源
最近更新 更多