Questions tagged [cggradientref]
8 questions
2
votes
1 answer
CGGradient now drawing exact color on UIBazierPath
I am using CGGradiant to draw a gardiant 3/4 cirlce using three colors starting with red to yellow to green. But CGGradiant always starting color from slightly yellow rather than red. I am using its because the start/end point i am giving in…

Mini2008
- 627
- 1
- 6
- 12
2
votes
1 answer
How can I draw a line with gradually change edge using CoreGraphics?
I want to accomplish a function just like a Brush. The area where finger swipes changes to trasparent with gradually changed border.
I can only change the color to crystal clear now with following codes:
-(void)touchesMoved:(NSSet *)touches…

John Tai
- 173
- 1
- 17
1
vote
1 answer
How to specify a rectangle from the CGPoint Start and End?
I have a rectangle bounds (10, 20, 100, 200) and the CGPoints are StartPoint (0.5, 0.5) and EndPoints as (1, 1). From these points how needs to calculate the segments bounds ? I need to apply this bounds for CGGradient for start point and end…

Parthiban
- 168
- 1
- 13
1
vote
1 answer
Making an oval gradient in shape
I am trying to find out how to create an oval gradient which is not a perfect circle. For example an american football/rugby/eye shape instead of a circle.
At the moment I have created a CALayer subclass as below which creates a circle. How can I…

StuartM
- 6,743
- 18
- 84
- 160
0
votes
0 answers
CGLayer CGGradient radial gradient poor results
I'm using this code to get CGLayer with alpha radial gradient:
let scale = UIScreen.main.scale
let roundedSize = round(size)
var canvasSize = size_t(roundedSize)
canvasSize *= size_t(scale)
let colorSpace =…

Prettygeek
- 2,461
- 3
- 22
- 44
0
votes
0 answers
iphonexs max crash, and it always happened when the app go back from background to foreground
the crash only happened on iPhone XS MAX and go back from background to foreground
[CAGradientLayer _clearContents]: unrecognized selector sent to instance 0x2815c31a0
CoreFoundation ___exceptionPreprocess + 232
1 libobjc.A.dylib …

HNOringin
- 1
- 1
0
votes
1 answer
Black to White radial gradient is giving whole black screen
It should be very simple to create a black to white radial gradient using Core Graphics, but even after many tries I am not able to figure where I am going wrong.
I want something like this:
This is my code:
CGFloat radius =…

maven25
- 231
- 2
- 12
0
votes
1 answer
cannot convert value of type int to expected argument type CGGradientDrawingOptions
I am new to Swift and I am trying to create a background gradient using CGGradient but I get the following error.
cannot convert value of type int to expected argument type CGGradientDrawingOptions
I do not get why I am not supposed to use an int…

user3517759
- 5
- 1
- 3