简体   繁体   English

在图像IOS中设置透明度

[英]Set transparency in image IOS

I have a table view, I have addeed image as subview for header, but that image is shown with bagckground white color,how to set transparency for image. 我有一个表视图,我已将图像添加为标题的子视图,但该图像显示为bagckground白色,如何设置图像的透明度。

TIA TIA

For this you have to set alpha of your UIImageView 为此,您必须设置UIImageView的alpha

Your_ImageView.alpha = 0.6;

You can also do it in your xib file 您也可以在xib文件中执行此操作

Assuming the name of your view is myTransparentSubView: 假设您的视图名称是myTransparentSubView:

[myTransparentSubView setBackgroundColor:[UIColor clearColor]];

If you are using the Interface Builder then set the background Color property accordingly within IB. 如果您使用的是Interface Builder,请在IB中相应地设置背景Color属性。

The simplest solution is to infact to create an image with a transparent background, however, you can use an Image Mask to get the desired effect. 最简单的解决方案是创建具有透明背景的图像,但是,您可以使用图像蒙版来获得所需的效果。

There is already an example of this here . 已经有一个这样的例子在这里

Use image Preview in MAC 在MAC中使用图像预览

Start with a png file. 从png文件开始。

You have to go to View > Show Edit Toolbar. 您必须转到视图>显示编辑工具栏。

Then widen the window so that you can see all of the icons. 然后加宽窗口,以便您可以看到所有图标。

Then click the icon that looks like a magic wand. 然后单击看起来像魔杖的图标。

And then click and drag on the color you want to erase. 然后单击并拖动要删除的颜色。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM