gpt4 book ai didi

iphone - 使用 colorWithPatternImage : 时如何保持图像透明度

转载 作者:太空狗 更新时间:2023-10-30 03:15:32 33 4
gpt4 key购买 nike

我准备了一张透明的图片,像这样:

alt text

对于两个 UIview,我这样配置背景颜色:

self.view.backgroundColor = [UIColor groupTableViewBackgroundColor];
self.dashedView.backgroundColor = [UIColor colorWithPatternImage:[UIImage imageNamed:@"red_square.png"]];

我希望红色方 block 在保留透明度的情况下在 UIView 上重复出现,但它已被这样的纯色填充:

alt text

我不明白为什么。有没有一种简单的方法来绘制具有透明度的平铺图像?或者我是否需要查看绘制 Core Graphics 模式?

最佳答案

图案图片应该保持透明度就好。

尝试[self.dashedView setOpaque:NO]

关于iphone - 使用 colorWithPatternImage : 时如何保持图像透明度,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4209383/

33 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com