English 中文(简体)
Clip UIView to UIIimage (UIImageView) using .png
原标题:Clip UIView to UIIimage(UIImageView) using .png

我有几处UIImage。 所有这些都采用平方格式。 我需要向UIImage的同学部分转播另一个形象或观念。 一些图像在外部边缘具有一些透明度。 如果我使用“ToBounds”号单,它只会lip上“UIImage”字眼,而不是真实的形象。 如果我把电线推向同一个高点,就会发现该中心的罚款,但我需要把电线放在右边或有时离开。 请参看照片,以作更好的解释。 我曾尝试过使用核心差距的几种方法,但是没有找到解决办法。

“entergraph

最佳回答

You can try using CALayer s mask property. It allows you to define

An optional layer whose alpha channel is used as a mask to select between the layer s background and the result of compositing the layer s contents with its filtered background.

为了掩饰一种观点:png,将面罩层的密码CGImageRef

Remember to import the QuartzCore framework though! ;)
Reference

问题回答

Take a Look at CALayer s mask property. You can set a layer which s opacity will be used as alpha information for the layer of the view (yourUIImageView.layer.mask).

例如,你可以使用CAGradient 如果有甲型肝炎的频道,则会增加甲型六氯环己烷的梯度。

Edit:Jenox更快,提供了更多的信息,因此他的回答应该说得正确。





相关问题
List Contents of Directory in a UITableView

I am trying to list the contents of Ringtones directory in a TableView, however, I am only getting the last file in the directory in ALL cells, instead of file per cell. This is my code: - (...

iPhone NSUserDefaults persistance difficulty

In my app i have a bunch of data i store in the NSUserdefaults. This information consists of an NSObject (Object1) with NSStrings and NSNumbers and also 2 instances of yet another object (Object2). ...

Writing a masked image to disk as a PNG file

Basically I m downloading images off of a webserver and then caching them to the disk, but before I do so I want to mask them. I m using the masking code everyone seems to point at which can be found ...

Resize UIImage with aspect ratio?

I m using this code to resize an image on the iPhone: CGRect screenRect = CGRectMake(0, 0, 320.0, 480.0); UIGraphicsBeginImageContext(screenRect.size); [value drawInRect:screenRect blendMode:...

Allowing interaction with a UIView under another UIView

Is there a simple way of allowing interaction with a button in a UIView that lies under another UIView - where there are no actual objects from the top UIView on top of the button? For instance, ...

热门标签