How can I fill a rect with an alpha color using CoreGraphics?
In my drawRect method, I am drawing a PNG image. On top of that, I want to draw a rect with a 20% alpha color, like this:
[[UIColor colorWithWhite:0.0 alpha:0.2] set]; UIRectFill(rect);
The problem is, that the alpha property seems to get ignored. No alpha is applied at all, just a black rectangle is drawn. How can I fix this? Thanks in advance!
- Fitting UIBezierPath/CGPath to circle
- CALayer: Single pixel line looks like 2 pixels
- Resize UIImage with aspect ratio?
- Why is CGFloat float on 32 bit and double on 64 bit?
- Rounded Corners only on Top of a UIView
- Implicit conversion from enumeration type 'enum CGImageAlphaInfo' to different enumeration type 'CGBitmapinfo' (aka) 'enum CGBitmapInfo')
2 Solutions Collect From Internet About “How can I fill a rect with an alpha color using CoreGraphics?”
CGContextSetBlendMode() before you draw the rect.
Set your view background color to transparent… It should work.
- Verifying RSA Signature iOS
- Swift 2 AVPlayer – Play Next video Previous Video
- How to change Status Bar text color in iOS 7
- how to hide the title bar(top bar) in iphone from a view
- Adding a user to PFRelation using Parse Cloud Code
- separate segue on section header as on table view row
- C++ using getline() prints: pointer being freed was not allocated in XCode
- Modify the Bounding Box Size of 3D model
- Return multiple values from a function in swift
- Use native iOS compass within an app
- Saving Image to core Data
- Trim UIImage border
- How do I collect key input in a video-game style Cocoa app?
- Add UIPageViewController in present app
- Swift lazy instantiating using self